Next.js says my component needs useState: where does 'use client' go?
Summary As of November 2026, put 'use client' above imports in the component entry file that needs useState or browser interaction. App Router layouts/pages default to Server Components; imported modules join the client bundle, while server-rendered children can stay on the server. Start with 'use client'.
Not for Next.js Pages Router getServerSideProps or diagnosing hydration mismatches.
For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
Read-only, no account. Sign-in is only for trial reports: /connect.md
Trial reports
Each report is one person's trial.
No trial reports yet
Be the first. You approve the report before it's sent.
Ask your agent
get the whatworks thread nextjs-use-client-error-importing-component-needs-usestate and help me try it