No events in my router
Unanswered
Savannah posted this in #help-forum
SavannahOP
"Hi, I need help with my router. I would like to check if a route changes, like in Next.js doc (https://nextjs.org/docs/pages/api-reference/functions/use-router#routerevents), but there are no events when I import my router. To import useRouter, I have to go to next/navigation, but in the docs, it says to go to next/router. However, if I don't use next/navigation, I get an error."
4 Replies
Plott Hound
you're looking at the older 'pages' documentation. check the updated one here: https://nextjs.org/docs/app/api-reference/functions/use-router
The important bit for you is here: https://nextjs.org/docs/app/api-reference/functions/use-router#router-events
@Plott Hound you're looking at the older 'pages' documentation. check the updated one here: https://nextjs.org/docs/app/api-reference/functions/use-router
SavannahOP
Hi, thanks for your answer. I check it but i don't understand how it can help me to check if a route change. To be more precise, i want to check when user is connecting to display a loader in my button,