Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

useeffect on update

const isInitialMount = useRef(true);

useEffect(() => {
  if (isInitialMount.current) {
     isInitialMount.current = false;
  } else {
      // Your useEffect code here to be run on update
  }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #useeffect #update
ADD COMMENT
Topic
Name
2+4 =