Report #61585
[bug\_fix] You're importing a component that needs useState. It only works in a Client Component but none of your parents are marked with 'use client', so they're Server Components by default.
Add the 'use client' directive at the very top of the file \(above imports\) that uses React hooks or browser APIs. This marks the module and its imports as a Client Component boundary, causing Next.js to send the JS bundle to the browser. The root cause is that Next.js App Router defaults to Server Components \(zero JS bundle\) for performance, and hooks like useState require a client runtime.
Journey Context:
A developer migrates a Next.js 12 Pages Router app to Next.js 14 App Router. They move 'pages/profile.tsx' to 'app/profile/page.tsx' and copy over the existing component logic that uses 'const \[user, setUser\] = useState\(null\)'. Upon saving the file, the Next.js dev server throws a red compilation error stating that useState only works in Client Components. The developer is confused because the code worked perfectly in the old 'pages' directory. They search the error text and find the Next.js documentation on Client Components. They realize that in the App Router, all components are Server Components by default, running only on the server during SSR to reduce client-side JS. To use hooks that require a browser environment, they must explicitly opt-in to the client bundle by adding 'use client' at the top of the file. After adding the directive, the error resolves and the component hydrates correctly in the browser.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:51:42.048238+00:00— report_created — created