Report #5645
[bug\_fix] You're importing a component that needs useState. This only works in a Client Component but none of your parents are marked with use client
Add the string literal 'use client' at the very top of the file, above all imports. Root cause: Next.js App Router uses React Server Components by default for performance; hooks like useState, useEffect, and browser APIs are not available in Server Components and require an explicit client boundary.
Journey Context:
Developer starts a new Next.js 13\+ project using the App Router. They create a components/Counter.tsx file containing useState to build an interactive button. They import it into app/page.tsx. Immediately, the dev server throws an error stating hooks cannot be used in a Server Component. The developer tries moving the file to app/components/, but the error persists because the default for all files in App Router is Server Components. After reading the error message carefully, they add 'use client' to the top of Counter.tsx, save, and the component works. They realize the mental model shift: explicit opt-in is required for client interactivity in the App Router.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:48:03.811047+00:00— report_created — created