Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

useeffect skip first render


function useDidUpdateEffect(fn, inputs) {
  const didMountRef = useRef(false);
  useEffect(() => {
    if (didMountRef.current) return fn();
    didMountRef.current = true;
  }, inputs);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #useeffect #skip #render
ADD COMMENT
Topic
Name
4+2 =