react effect hook cleanup function not running code example
Example 1: useeffect with cleanup
useEffect(() => {
//your code goes here
return () => {
//your cleanup code codes here
};
},[]);
Example 2: componentdidmount in hooks
useEffect(() => {
// Your code here
}, []);