Next.js · Junior · Question 10 of 75
A component uses useState and onClick but crashes with an error. What's missing?
- ✓Correct answer: The
'use client'directive at the top of the file - 2A
<Suspense>wrapper around the component - 3The export
export const dynamic = 'force-dynamic'
Explanation
State hooks and event handlers work only in client components. 'use client' declares the boundary of the client part. Best practice is to move interactivity into small client components and keep the page itself on the server.