Question · Next.js course · Module 1: Next.js Configuration

Hook in a Server Component

What should you do when an error appears about using the useState hook in a Server Component?

Answer options

  • Move the state logic into a Client Component
  • Add await before useState
  • Import useState from next/server
  • Remove the use client directive
Show the answer

Correct answer:

  • Move the state logic into a Client Component