React · Junior · Question 53 of 75
What should a component return to render nothing?
- ✓Correct answer:
null - 2
undefinedis required - 3An empty
<div />
Explanation
Returning null renders nothing but the component still exists (its hooks and state live on). Since React 18, returning undefined is also allowed but null is clearer.