<div id="root"></div>
h1 {
font-weight: bold;
font-size: 16px;
}
#root > div {
width: 300px;
margin: auto;
border: 1px solid #ddd;
border-radius: 4px;
margin-top: 40px;
padding: 16px;
box-shadow: 0 0 4px rgba(0,0,0,0.1);
}
xxxxxxxxxx
import React, { useRef } from "https://esm.sh/react@18";
import ReactDOM from "https://esm.sh/react-dom@18";
function Card({ title }) {
return (
<div>
<CardHeader title={title} />
<CardBody />
</div>
);
}
function CardBody({ children }) {
return (
<div>
{children}
</div>
)
}
const CardTitle = ({ children }) => <h1>{children}</h1>;
function CardHeader({ title, children }) {
return (
<div>
<CardTitle>
{title}
</CardTitle>
{children}
</div>
)
}
ReactDOM.render(<Card title="Olá pessoas" />,
document.getElementById("root"))
This Pen doesn't use any external JavaScript resources.