Report #85315
[bug\_fix] You're importing a component that needs useState. It only works in a Client Component but none of its ancestors are marked with "use client"
Add the 'use client' directive at the very top of the file \(before imports\) where the hook is used. Root cause: Next.js App Router defaults to Server Components which run only on the server; React hooks require browser APIs.
Journey Context:
Developer migrates from Pages Router to App Router. Copies an existing component containing \`const \[count, setCount\] = useState\(0\)\` into \`app/counter/page.tsx\`. Immediately gets a red error overlay stating the component needs 'useState' but isn't marked as a Client Component. Developer is confused because it worked in Pages Router \(which is client-side by default\). They try adding 'use client' to the root layout.tsx, which technically works but defeats the purpose of Server Components and causes the entire app to be client-side rendered. Eventually, they realize they must add 'use client' specifically to the file using hooks, or extract the hook-using logic into a separate Client Component that is imported by a Server Component page.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:47:17.473658+00:00— report_created — created