Rajesh Naroth
1 min readOct 15, 2020

--

When the useEffect's dependency array is empty [], the clean up function is only called when the component un-mounts, such as when you move away from the page or replace a view. If you forget to provide a dependency array, the effect and clean up is called during re-renders.

--

--

Rajesh Naroth
Rajesh Naroth

Written by Rajesh Naroth

Frontend Architect, San Jose, CA

No responses yet