学习总结
Seven丶Alice
现在拯救还来的及吧
展开
-
react Component 与 PureComponent 的区别
两者的区别在于React.Component 并未实现shouldComponentUpdate(),而React.PureComponent中以浅层对比prop和state的方式实现了该函数。如果赋予组件相同的props和state,render()函数会渲染相同的内容,在某些情况下使用PureComponent可提高渲染性能。注意:React.PureComponent 中的 shouldComponentUpdate() 仅作对象的浅层比较。如果对象中包含复杂的数据结构,则有可能因为无法检查深原创 2020-06-06 10:14:38 · 230 阅读 · 0 评论 -
js数组方法
**js数组方法**数组遍历/** * Array.prototype.map() * map遍历原数组返回一个新数组 * 新数组做数组方法操作不会影响到原数组,如果对新数组内的元素进行操作的话,原数组内元素的数据可能会受影响。 * 注意:如果不主动return 则默认返回undfined */let oldArr = [1, 2, 3,{name:'seven',age:18}];let newArr = oldArr.map(item => item);newArr.原创 2020-05-16 11:36:22 · 121 阅读 · 0 评论