Report #64590
[bug\_fix] Server Component trying to use React Hook
Move the hook usage to a Client Component \(file with 'use client'\), or refactor the logic to not require client-side state. If the component needs both server data and client interactivity, pass server data as props to a Client Component child.
Journey Context:
Developer is refactoring a Pages Router app to App Router. They move a component from pages/index.tsx to app/page.tsx. This component uses useRouter from next/navigation or useState. On running the dev server, they get the error that hooks only work in Client Components. Confused because they didn't mark the file as a Server Component explicitly, they learn that in App Router, all components are Server Components by default. They either add 'use client' to the top of the file, or if they need interactivity, they extract the interactive part into a separate Client Component and import it into the Server Component page.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:54:00.999607+00:00— report_created — created