1class Test extends React.Component {
2 constructor() {
3 console.log('Constructor')
4 super();
5 this.state = {
6 count: 0
7 };
8 }
9
10 componentDidMount() {
11 console.log("component did mount");
12 }
13 componentDidUpdate() {
14 console.log("component did update");
15 }
16
17 onClick = () => {
18 this.setState({ count: this.state.count + 1 });
19 };
20 render() {
21 console.log("render");
22 return (
23 <div>
24 Hello Test
25 <button onClick={this.onClick}>
26 {this.state.count}
27 </button>
28 </div>
29 );
30 }
31}
32
33
34//--for first time
35//Constructor
36//render
37//component did mount
38//--for any update
39//render
40//component did update