Next.js Discord

Discord Forum

NextRouter was not mounted.

Answered
Cinnamon posted this in #help-forum
Open in Discord
CinnamonOP
Trying to get data from the link using:
const router = useRouter();
if (!router.isReady) return null;
const {business, table} = router.query;

and importing this component to a page, but loading the page gives me the error page attached. please help and thank you
Answered by !=tgt
where are you importing the router from?
View full answer

4 Replies

Answer
for app dir you import from next/navigation, while for pages dir you import from next/router
CinnamonOP
thank you
you saved me