Report #16518
[bug\_fix] You're importing a component that needs useState. It only works in a Client Component but none of its parents are marked with "use client"
Add the \`"use client"\` directive at the top of the file that uses React hooks or browser APIs. Root cause: Next.js App Router defaults to Server Components for performance; any usage of \`useState\`, \`useEffect\`, or DOM APIs requires the component to be marked as a Client Component to be included in the client bundle.
Journey Context:
Developer is migrating from Pages Router to App Router. They create a \`components/Counter.tsx\` with a simple \`useState\` hook to increment a number. They import it into \`app/page.tsx\`. Immediately, the dev server shows the error: 'You're importing a component that needs useState...'. Developer tries adding \`"use client"\` to \`page.tsx\`, which fixes the error but causes the entire page to be client-side rendered, losing the benefits of Server Components. They re-read the error message carefully and realize the directive should be placed at the top of \`Counter.tsx\` itself. This creates a client boundary: the page remains a Server Component \(can fetch data\), while the Counter is hydrated as an interactive island.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T02:51:11.360884+00:00— report_created — created