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.