Next.js
Next.js useRouter was used without a mounted Next router
Next.js reported that useRouter was called outside the expected router context, which commonly happens in unit tests or when next/router is used inside the app directory.
Next.js
Next.js reported that useRouter was called outside the expected router context, which commonly happens in unit tests or when next/router is used inside the app directory.
Observed message
NextRouter was not mounted
Why it happens
How to fix it
Official reference
Next.js Docs: NextRouter was not mountedRelated errors
Explore more