React · Junior · Question 10 of 75
What is children in React?
- ✓Correct answer: A prop with the content passed between the component's tags
- 2A global array of all child components of the current app
- 3A built-in hook for accessing the component's nested DOM elements
Explanation
<Card><h2>Title</h2></Card> passes the <h2> in props.children. It's the basis of composition: wrappers, layouts and modals accept arbitrary content. children can be a string, an element, an array or a function (the render props pattern).