React triggers page rendering in several ways

initialization

When the component is first loaded, the render function is called once

Update

  1. state changes
  2. 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>

Guess you like

Origin www.cnblogs.com/sunhang32/p/12724134.html