Next.js · Junior · Question 44 of 75
Can you use the useState and useEffect hooks in a server component?
- ✓Correct answer: No: server components have no state or effects
- 2Yes, but only
useState, notuseEffect - 3Yes, if the component is declared as an
asyncfunction
Explanation
A server component runs once to produce a result and doesn't "live" afterwards. State, effects and event handlers are client features. A server component can render a client component and pass it data via props.