Report #83993
[bug\_fix] You're importing a component that needs 'use client'. This error occurs when you try to use a Client Component in a Server Component.
Add the 'use client' directive at the very top of the file \(before any imports\) to mark it as a Client Component, or extract the client-only logic into a separate Client Component and import it into the Server Component.
Journey Context:
Developer is building a dashboard with Next.js 14 App Router. They create a new file components/Chart.tsx that imports and uses the Recharts library to display data visualization. They import Chart into their app/dashboard/page.tsx \(which defaults to a Server Component\). Immediately upon saving, the dev server throws an error: 'use client' is required. Developer initially thinks they should add 'use client' to the page.tsx to fix it, but realizes that would force the entire page to be client-side rendered, losing the SEO and performance benefits of Server Components. After carefully reading the error message and checking the Next.js documentation, developer understands that any component using React hooks \(useState, useEffect\), browser APIs \(window, document\), or third-party libraries that use hooks must be a Client Component. The solution is to add 'use client' specifically to the Chart.tsx file, keeping the parent page.tsx as a Server Component that can fetch data and pass it as props to the Chart. This maintains the architecture where data fetching happens on the server and only the interactive visualization happens on the client.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T23:34:35.077799+00:00— report_created — created