Report #12704
[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', so they're Server Components by default.
Add the 'use client' directive at the very top of the file \(above imports\) to mark the boundary as a Client Component, allowing React hooks to be used.
Journey Context:
Developer migrates from Next.js Pages Router to App Router. Copies a working component using useState into the app directory. Immediately gets build error stating useState only works in Client Components. Confused because it worked before \(Pages Router is client-side rendered by default\). Reads error message carefully, learns that App Router defaults to Server Components for performance. Searches docs for 'use client'. Discovers it's a string directive, not an import. Tries adding 'use client' below imports, doesn't work. Moves it to absolute top of file. Error resolves. Understands that this marks the component and all its children as client components, creating a boundary.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T16:45:04.529091+00:00— report_created — created