Report #37640
[bug\_fix] You're importing a component that needs useState, but it's marked as a Server Component
Add the 'use client' directive at the very top of the file \(before imports\) to indicate the module should be sent to the client bundle and executed in the browser.
Journey Context:
Developer creates a new component in the app directory using useState to manage a modal open state. Upon saving, Next.js throws an error during the server render phase stating that hooks can't be used in Server Components. The developer is confused because they assume all components are client components by default \(coming from Pages Router\). They try moving the component to the components folder, same error. They check the Next.js docs on Rendering and discover that App Router defaults to Server Components. Adding 'use client' at the top of the file immediately resolves the error by forcing the component into the client boundary.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T17:39:38.506907+00:00— report_created — created