useEffect return does not triggers after route change
Answered
Asian black bear posted this in #help-forum
Asian black bearOP
The cleanup function in useEffect does not triggers on route change. How can I work around it?
Answered by B33fb0n3
you can add the pathname as dependency to your use effect. So the useEffect will trigger on route change as well. To get the pathname use
usePathname