Answers for "useeffect on update"

0

useeffect on update

const isInitialMount = useRef(true);

useEffect(() => {
  if (isInitialMount.current) {
     isInitialMount.current = false;
  } else {
      // Your useEffect code here to be run on update
  }
});
Posted by: Guest on August-30-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language