Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

dont trigger useeffect on start

Refer
https://stackoverflow.com/a/71342621/15187131

// Or use useLayoutEffect
const firstUpdate = useRef(true);
  useLayoutEffect(() => {
    if (firstUpdate.current) {
      firstUpdate.current = false;
    } else {
     // do things after first render
  }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dont #trigger #useeffect #start
ADD COMMENT
Topic
Name
3+7 =