Children Prop
RE · Componentssyntax
function Wrapper({ children }) {
return <div className="wrapper">{children}</div>;
}example
function Card({ children, title }) {
return (
<section className="card">
<h2>{title}</h2>
<div className="card-body">{children}</div>
</section>
);
}
// Usage
<Card title="Profile">
<p>This content is passed as children.</p>
</Card>output
Renders a card wrapper around the paragraph.Note children can be any renderable content: text, elements, arrays, or even functions (for render props).