📜  复制组件确实更新了挂钩 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:36.909000             🧑  作者: Mango

代码示例1
const mounted = useRef();
useEffect(() => {
  if (!mounted.current) {
    // do componentDidMount logic
    mounted.current = true;
  } else {
    // do componentDidUpdate logic
  }
});