VibeDict

🧩Needs use client (Next.js)

What you'll see
You're importing a component that needs "useState". This React Hook only works in a Client Component. To fix, mark the file (or its parent) with the "use client" directive.

In Next.js, something that runs in the browser, like a button click or state (useState), was used in a server-only file.

🤔 Why does it happen?

  • The file that uses things like useState, useEffect, or onClick doesn't have "use client" at the top

🔧 Try this

  1. Add "use client" as the very first line of the file that uses those features
  2. It's better to move just the interactive part into its own component and add it only there, not to the whole page

🤖 Ask your AI like this

I get the error below in Next.js. Please split out only the parts that need to run in the browser into a separate component, and add "use client" to that file to fix it. [Paste the full error here]

Replace the [ ] parts with your own situation, and paste the error with a few extra lines before and after it.

Related terms

Other errors in this group