Can you pass a React component as a prop? Explain Render Props.

Tests React composition. Yes, functions and JSX are valid prop values. Strong answers explain inversion of control, contrast with children, and cite dynamic layouts. Red flag: conflating render props with HOCs or saying props only accept primitives.
What's really being asked
This question tests whether you understand React's core model of components as first-class JavaScript values, not just template syntax. It separates engineers who memorize JSX patterns from those who understand the underlying composition model. Specifically, it probes your knowledge of inversion of control, dynamic composition, and the distinction between component references and render functions.
The full answer
First, confirm that yes, you can pass any valid JavaScript value as a prop, including functions, JSX elements, and component references. Second, distinguish between passing a component reference like Header={MyHeader} and passing a render function like renderItem={(item) => <Row>{item}</Row>}. Third, explain the practical benefit: the parent controls what renders while the child controls when and where it renders, which is inversion of control. Fourth, contrast this with the children prop, noting that render props are explicit and named, making them better for multiple insertion points or when the child needs to inject data. Fifth, give a concrete use case.
The mistakes people make
Claiming that props only accept strings, numbers, or simple objects. Confusing render props with Higher-Order Components by saying it is just another way to write an HOC without clarifying that HOCs wrap components at definition time while render props compose at runtime. Another red flag is suggesting useContext or global state as the modern replacement without acknowledging that render props still solve specific localized composition problems that hooks do not fully replace. Overcomplicating the explanation with class component syntax without being able to explain the concept in function components.
What usually comes next
How does this differ from passing JSX as children? When would you choose a render prop over a custom hook? Can you pass a component reference versus a function that returns JSX, and what are the typing differences in TypeScript? How do you avoid unnecessary re-renders when passing render functions inline? Have you used this pattern in a design system or library?
A concrete example
Imagine a DataTable component that fetches rows but does not know how each row should look. It accepts a renderRow prop. The parent passes renderRow={(row) => <CustomCell data={row} />} and the DataTable internally maps over rows calling that function with each row object. This keeps the table logic reusable while letting every consumer define its own columns and cell behavior without forking the component.
Interview question
What is the key architectural difference between passing a render function prop and passing a component reference prop in React?
- a.A render function is called by the child with internal data, letting the parent control what renders while the child controls when and where.Correct
- b.A component reference can only receive primitive values as props, while a render function accepts any JavaScript object.
- c.A component reference automatically receives shared state via Context, eliminating the need for prop drilling.
- d.A render function wraps the component at definition time, behaving exactly like a Higher-Order Component.
Why? this is the answer
This captures inversion of control: the parent supplies the function (what to render) and the child invokes it with internal data (when and where). Option D is tempting because both patterns enable reuse, but HOCs wrap components at definition time while render props compose at runtime.
Just read this? Test yourself on what you have been reading.
Read the original → react.dev
- #react
- #component-composition
- #render-props
- #design-patterns
- #advanced-react
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on react — each one lists the topics its interview covers.
See open roles