Report #51696
[bug\_fix] useRouter is undefined or has wrong properties \(query vs searchParams\) when migrating from Pages to App Router
In App Router Client Components, import useRouter from 'next/navigation' \(not 'next/router'\). For query parameters, use the useSearchParams hook from 'next/navigation' instead of router.query. For navigation, use the router.push\(\) from next/navigation which returns void, not a promise.
Journey Context:
Developer migrating an existing Pages Router app to App Router copies over a component that uses import \{ useRouter \} from 'next/router'. In the App Router, this import returns undefined or causes runtime errors because the App Router uses a different routing context. Even after fixing the import to 'next/navigation', they find that router.query is undefined; searching the docs reveals that App Router uses useSearchParams\(\) for query strings and usePathname\(\) for the path. Additionally, they discover that router.push\(\) in next/navigation behaves synchronously \(returns void\) unlike the Pages Router version which returned a promise, requiring refactoring of navigation logic.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:16:00.349861+00:00— report_created — created