Next.js Discord

Discord Forum

how to make gif reset between dynamic routes

Unanswered
Giant panda posted this in #help-forum
Open in Discord
Giant pandaOP
Hey guys, I am having an issue where if the user changes routes, the gif on the page will not reset from the beginning when the user goes to that page. anyway to change this behavior?

1 Reply

try subscribing to usePathname and create another state (display) then if pathname changes, just setDIsplay(false) and a useEffect that setDisplay to true if display is false.

Then you conditionally render the gif with display to only display if display is true