"shouldComponentUpdate 是做什么的?"

shouldComponentUpdate 是做什么的?

shouldComponentUpdate 这个方法用来判断是否需要调用 render 方法重新描绘 dom。因为 dom 的描绘非常消耗性能,如果我们能在 shouldComponentUpdate 方法中能够写出更优化的 dom diff 算法,可以极大的提高性能。

PS:写作不易,如要转裁,请标明转载出处。

微信小程序:前端开发宝典

猜你想看
React 中的StrictMode(严格模式)是什么?
如何在 ReactJS 的 Props上应用验证?
组件库如何做按需加载?
redux reducer为什么不能修改state?
useMemo & useCallback的作用是什么?
登录
注册
回顶部