FE-Interview
FE-Interview copied to clipboard
说一下 React.Component 和 Ract.PureComponent 的区别
扫描下方二维码,获取答案以及详细解析,同时可解锁800+道前端面试题。
- Component只要state变就会重新渲染
- PureComponent是通过浅比较来实现shouldComponentUpdate,当prop或state的值或引用地址发生改变时,组件就会发生更新