The children prop
A card on a page holds a title, some text, maybe a button. If you gave the card
a prop for each piece, it could only hold the pieces you planned for. React
takes another route: nest the content between the tags, and the component
receives it as a special prop called children.
function Card({ children }) {
return <section>{children}</section>;
}
<Card>
<p>Hello</p>
</Card>
Everything between <Card> and </Card> — here a paragraph — arrives as
children. The component decides where it lands, and it never needs to know
what the content is. That is how you build reusable containers: the caller
supplies the inside, the component supplies the structure around it.
children can be a single element, several elements, or plain text. React
treats it like any other prop, so you can render it wherever it fits.
Your job is to render the nested content inside a wrapper.
Challenge
A wrapper drops whatever you put inside it. Export an App component from
App.jsx that takes a children prop and renders it inside a <section>
element.
The Test renders <App><p>Hello</p></App> and looks for that paragraph inside
the section. The starter renders an empty section and ignores its children, so
the Test fails. Pass the children through to the section.