Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

useeffect cleanup in reactjs

import React, { useEffect } from 'react';

function FriendStatus(props) {

  useEffect(() => {
    // do someting when mount component
    
    return function cleanup() {
      // do something when unmount component
    };
  });
}
Source by reactjs.org #
 
PREVIOUS NEXT
Tagged: #useeffect #cleanup #reactjs
ADD COMMENT
Topic
Name
8+2 =