📜  使用效果返回 - 任何代码示例

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

代码示例4
const isInitialMount = useRef(true);

useEffect(() => {
  if (isInitialMount.current) {
     isInitialMount.current = false;
  } else {
      // Your useEffect code here to be run on update
  }
});