初次加载组件的时候,会调用一次render函数

更新

  1. state发生改变
  2. props发生改变

强制更新

如果不是前两种,还希望组件发生更新,可以使用
this.forceUpdate()

注意: <button onClick={() => this.forceUpdate()}>强制渲染 不可以写为<button onClick={this.forceUpdate}>强制渲染</button>

相关文章:

  • 2021-07-05
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2018-12-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2021-07-27
  • 2022-12-23
相关资源
相似解决方案