Report #64579
[bug\_fix] useState only works in Client Components \(missing 'use client' directive\)
Add the 'use client' directive at the very top of the file \(above imports\) that uses browser hooks or APIs. If only part of the tree needs interactivity, extract that into a Client Component and import it into a Server Component.
Journey Context:
Developer creates a Counter component with useState and imports it into app/page.tsx. The dev server immediately crashes with 'useState only works in Client Components'. Confused because they assumed components are client by default \(coming from Pages Router\), they try moving the component to different folders. They search the error and find Next.js docs explaining Server Components are the default in App Router. They add 'use client' to the top of the file, which fixes it. They then learn to minimize client boundaries by extracting only interactive parts into Client Components, leaving the parent as a Server Component for better performance.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:52:51.776244+00:00— report_created — created