I have a Nav (functional) component that contains a simple animation using GSAP. It animates the first time the page loads. I would like it to animate every time user clicks on a different page (I'm using React Reach Router for page navigation)
I know with a class based component, I could possibly use componentDidMount
method but how can I achieve this with a functional component? And I don't think window.onload
will work since site isn't actually re-loading, but re-routed.
Here's the code in question