-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathapp.js
More file actions
37 lines (36 loc) · 704 Bytes
/
Copy pathapp.js
File metadata and controls
37 lines (36 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React from './react/index';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
test: 'init'
};
this.test=[1,2,3]
}
handleClick(e){
this.setState({
test:'test'
})
}
componentDidMount(){
console.log('mount')
this.setState({
test:'mount'
})
}
componentWillMount(){
console.log('willMount')
}
componentWillUpdate(){
console.log('willupdate')
}
componentDidUpdate(){
console.log('didupdate')
}
render() {
return <div>
<span>{this.state.test}</span>
<button onClick={this.handleClick.bind(this)}>改变状态</button>
</div>;
}
}