Report #39034
[bug\_fix] useRouter imported from 'next/router' returns undefined or missing properties in App Router
Import useRouter from 'next/navigation' instead of 'next/router' when using the App Router, and adapt to the new API \(using useSearchParams for query, usePathname for path\).
Journey Context:
Developer migrating from Next.js Pages Router to App Router, or following an outdated tutorial, writes import \{ useRouter \} from 'next/router' in a Client Component. They try to access router.query but find it's undefined, or the hook throws an error. They search and discover that next/router is exclusively for the Pages Router. The App Router uses a new navigation API in the next/navigation package. The new useRouter has a different shape \(no query object, instead use useSearchParams\). Developer changes the import path and refactors to use the new hooks, resolving the undefined errors and making the navigation work correctly in the App Router architecture.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:59:31.518043+00:00— report_created — created