State Management · Junior · Question 16 of 75

Which technique often solves prop drilling without Context?

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.

Further reading

Problem with a question

State Management · Junior · question 16

Test yourself

Take the State Management · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz