Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

replicate component did update hooks

const mounted = useRef();
useEffect(() => {
  if (!mounted.current) {
    // do componentDidMount logic
    mounted.current = true;
  } else {
    // do componentDidUpdate logic
  }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #replicate #component #update #hooks
ADD COMMENT
Topic
Name
5+9 =