React常用优化方案

30 阅读1分钟

1、通过Css模拟 v-show

2、循环使用key

3、使用fragment减少层级

4、JSX中不要定义函数

5、要在构造函数中bind this

6、使用shouldComponentsUpdate 、PureComponent (class组件)、 React.memo (函数组件)

7、useMemo 、useCallBack

8、异步组件

9、路由懒加载

10、SSR