react should useeffect call on every render code example
Example 1: react run useeffect only once
useEffect(() => {
// Initialization code comes here
}, []);
Example 2: useeffect react
useEffect(() => {
// code goes here
return () => {
// cleanup code codes here
};
},[]);