Report #11762
[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 very top of the file \(above imports\) that uses client hooks like \`useState\`, \`useEffect\`, or browser APIs.
Journey Context:
Developer creates a new interactive button component in \`components/ActionButton.tsx\` using \`import \{ useState \} from 'react'\` and \`const \[count, setCount\] = useState\(0\)\`. They import this into \`app/page.tsx\` \(which defaults to a Server Component\). Immediately, the Next.js dev server throws an error: 'You're importing a component that needs useState. It only works in a Client Component...' The developer is confused because they thought all React components could use hooks. They search the error and discover React Server Components \(RSC\). They try adding \`'use client'\` to \`page.tsx\`, which resolves the error but converts the entire page to a Client Component, losing the benefits of SSR. They then realize the directive should only be applied to the specific component that requires client interactivity. They move \`'use client'\` to the top of \`ActionButton.tsx\` and remove it from \`page.tsx\`. The error resolves, the page remains a Server Component, and only the ActionButton hydrates on the client.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T14:15:12.854272+00:00— report_created — created