initialization
When the component is first loaded, the render function is called once
Update
- state changes
- props change
Force update
If it is not the first two, and you want to update the component, you can use
this.forceUpdate()
Note:
<button onClick={() => this.forceUpdate()}>
Forced rendering cannot be written as<button onClick={this.forceUpdate}>强制渲染</button>