State Management · Junior · Question 16 of 75
Which technique often solves prop drilling without Context?
- ✓Correct answer: Composition: pass ready-made elements via
childrenor other props - 2Wrapping every intermediate component in
React.memo - 3Moving the data into a
useRefat the root
Explanation
<Layout sidebar={<UserMenu user={user} />}> - Layout doesn't need to know about user; it just renders the passed element. The React docs recommend trying composition first, since Context makes components harder to reuse.