CodePark/ questions / Server & Client Components
START PRACTICINGPRACTICE
Frontend question · Next.js › Server & Client Components

Which of these can a Server Component do?

Be an async function that awaits a database query

"Be an async function that awaits a database query" is correct. Server Components run once on the server, so they can be async and talk to the database directly. The other options are wrong: useState, an onClick handler and window.localStorage all need the browser or React state, so they need a Client Component.