Report #104457
[bug\_fix] Next.js App Router: \`useRouter\` is not a function or \`Error: useRouter only works in Client Components...\`
Add \`'use client'\` directive to the component file that uses \`useRouter\` from \`next/navigation\`. Alternatively, use \`import \{ useRouter \} from 'next/router'\` in Pages Router, but for App Router you must use \`next/navigation\` and a client component.
Journey Context:
Developers migrating from Pages Router to App Router often use \`useRouter\` from \`next/navigation\` in a server component. Next.js throws an error because \`useRouter\` is a React hook that requires client-side state. The error message clearly says to add \`'use client'\`. However, developers might mistakenly add the directive to the parent component or to a layout file. The fix is to add \`'use client'\` to the file that actually calls \`useRouter\`. Another common mistake is using \`useRouter\` in a layout file that is a server component by default. The root cause is that App Router components are server components by default, and hooks are only available in client components. The proven fix is to mark the file with \`'use client'\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-23T20:03:51.626643+00:00— report_created — created