Report #8680
[bug\_fix] You're importing a component that needs 'use client'. It only works in a Client Component but none of its parents are marked with 'use client', so they're Server Components instead.
Add the 'use client' directive at the very top of the file \(before any imports\) that uses client-side features like useState, useEffect, or browser APIs. This marks the file and all its imports as Client Components, creating a boundary in the React tree.
Journey Context:
Developer is migrating a working component from Next.js Pages Router to the App Router. The component uses useState to manage a form input. When they import it into a page.tsx file, the build fails with the error. Developer checks the import path and component logic, confused because it worked in the Pages Router. They realize the App Router defaults all components to Server Components unless opted out. They try adding 'use client' inside the component function, which fails with a syntax error. They learn it must be at the top of the file above imports. After adding it, the component works. They understand that this directive moves the component and its children to the client bundle, increasing client-side JavaScript, so they should keep Server Components as the default.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T06:12:19.093244+00:00— report_created — created