Catalog
  1. 1. render触发的条件
  2. 2. 避免不必要的render
render在什么时候会被触发?如何避免不必要的render?

render触发的条件

  • 第一次挂载
  • state改变
  • props改变

避免不必要的render

  • 利用shouldComponentUpdate钩子函数,通过它的返回值react会决定要不要render,返回false不会渲染
Author: Erealm
Link: http://erealmsoft.github.io/2019/09/25/react/react-render/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.

Comment