Using components with the props object
Fri Jun 17 2022 04:50:20 GMT+0000 (Coordinated Universal Time)
Saved by
@patdevwork
<div id="root"></div>
<script type="text/babel">
function Header(props) {
return (
<header>
<h1>{props.name} Kitchen</h1>
</header>
);
}
function Main(props) {
return (
<section>
<p>
We serve the most {props.adjective} food
around
</p>
</section>
);
}
function Footer(props) {
return(
<div>
<p>Copyright {props.year}</p>
</div>
)
}
function App() {
return (
<div>
<Header name="Patrick" />
<Main adjective="amazing" />
<Footer year = {new Date().getFullYear()} />
</div>
);
}
ReactDOM.render(
<App />,
document.getElementById("root")
);
</script>
content_copyCOPY
Comments