react性能优化方案

  • 优化shouldComponentUpdate生命周期的逻辑,避免不要的渲染和dom操作
  • componentWillUnmount生命周期阶段,清楚定时器、订阅、监听等操作
  • 为列表数据添加唯一标识key
  • 使用PureComponentmemo减少子组件的重复渲染
  • 路由懒加载
  • 为组件创建错误边界

猜你喜欢

转载自blog.csdn.net/Dax1_/article/details/126684016