Report #55980
[bug\_fix] TypeError: Cannot read properties of null \(reading 'push'\) or useRouter is not mounted when using useRouter from next/router in App Router
Import \`useRouter\` from \`next/navigation\` instead of \`next/router\`. The App Router uses a different routing system where \`useRouter\` from \`next/navigation\` provides the correct router instance for the new routing paradigm.
Journey Context:
Developer migrates large codebase from Next.js Pages Router to App Router. Keeps existing component using \`import \{ useRouter \} from 'next/router'\`. Upon loading App Router page, app crashes with 'useRouter is not mounted' or null pointer when accessing \`router.push\`. Developer checks imports, realizes App Router has new navigation system. Changes import to \`next/navigation\`. Notes new \`useRouter\` lacks some legacy properties like \`asPath\` \(replaced by \`usePathname\`\) and \`query\` \(replaced by \`useSearchParams\`\). Updates component to use new hooks where necessary. Navigation works correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T00:27:22.035166+00:00— report_created — created