美文网首页
如何写高性能的ReactJs

如何写高性能的ReactJs

作者: 蛮吉大人123 | 来源:发表于2018-07-10 09:08 被阅读2次
  • 合理分组件——render影响的最小单位,例如列表的单项
  • 设置合理的key——不要随意使用数组下标作为key
  • 单次渲染的节点数尽可能少
  • 合理使用“shouldComponentUpdate”

原则

  • render执行次数尽可能少
  • 为diff尽可能的提供方便, 设置合理的key
  • 减少dom数

相关文章

网友评论

      本文标题:如何写高性能的ReactJs

      本文链接:https://www.haomeiwen.com/subject/mzaxpftx.html