相关疑难解决方法(0)

React Hooks-如何实现shouldComponentUpdate?

我知道您可以通过将数组作为可选的第二个参数传递来告诉React跳过效果。

例如:

useEffect(() => {
  document.title = `You clicked ${count} times`;
}, [count]); // Only re-run the effect if count changes
Run Code Online (Sandbox Code Playgroud)

但是,如果我想控制比较怎么办?添加我自己的比较逻辑。

我希望React.memo可以将一个函数作为第二个参数传递给您。

reactjs react-hooks

23
推荐指数
4
解决办法
2万
查看次数

标签 统计

react-hooks ×1

reactjs ×1