![]() |
1
2
这个 doc
在这里,您需要使用PureComponent或shouldComponentUpdate钩子,以便仅在需要时进行更新。 您使用的是无状态组件,它不能有任何生命周期方法。要使用lifecycle方法,您需要使用基于类的statefull组件。
替换:
如果不使用PureComponent,组件将在任何组件的每次状态更改时更新。但是使用PureComponent,它只有在检测到新项时才会更新。 如果您想使用shouldcomponentupdatehook,那么请向前看 here 供参考。 |
![]() |
Ângelo Rigo · ReactJS映射:如何迭代[关闭] 4 月前 |
![]() |
vatsal chauhan · 即使在字体预加载时,文本加载也很慢 5 月前 |
![]() |
noblerare · Vite错误-未定义导出(SSR) 5 月前 |