React elements like and are just objects, so you can pass them as props like any other data
use the special children prop to pass children elements directly into their output
Use composition instead of inheritance, haven’t found any use cases where need creating component inheritance hierarchies
function FancyBorder(props) {
return (
<div className={'FancyBorder FancyBorder-' + props.color}>
{props.children}
</div>
);
}
function WelcomeDialog() {
return (
<FancyBorder color="blue">
<h1 className="Dialog-title">
Welcome
</h1>
<p className="Dialog-message">
Thank you for visiting our spacecraft!
</p>
</FancyBorder>
);
}