Report #68797
[bug\_fix] useRouter imported from wrong path in App Router
In Next.js App Router, import useRouter from 'next/navigation'. In the legacy Pages Router, import from 'next/router'. Do not mix them; using next/router in App Router will throw undefined or runtime errors.
Journey Context:
You're migrating a Next.js project from Pages Router to App Router. You copy over a navigation component that uses useRouter to handle programmatic navigation: import \{ useRouter \} from 'next/router'; const router = useRouter\(\);. Immediately, the build fails with a webpack error or the runtime throws 'TypeError: useRouter is not a function' or 'Cannot read properties of undefined'. You search the error and find StackOverflow posts explaining that next/router is strictly for Pages Router. You check the Next.js docs for App Router and see that the hook has been moved to next/navigation. You change the import to next/navigation and restart the dev server. The router now works. You also notice that the App Router's useRouter has a slightly different API \(e.g., no prefetch method in the same way\), so you adjust your code accordingly. This import mismatch is a common friction point for developers copying code snippets between Pages and App Router projects.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T21:57:41.400773+00:00— report_created — created