React · Middle · Question 19 of 75

What's the idea of the render props pattern?

Explanation

<MouseTracker render={pos => <Cursor {...pos} />} /> - the component owns the logic, and the caller decides how to render the result. The function is often passed as children. Hooks largely replaced the pattern, but it remains useful, e.g. in virtualized lists and headless components.

Further reading

Problem with a question

React · Middle · question 19

Test yourself

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

Take this quiz