← Trail· Lesson 2 of 8
Props
Pass data from parent to child with props.
TODO i18n: Full body translation pending. Title and description are localized; the body below remains in Portuguese for now.
Props são os argumentos do componente. Fluem de cima para baixo e são somente leitura.
function Card({ title }: { title: string }) {
return <article><h2>{title}</h2></article>;
}
function App() {
return <Card title="Bem-vindo" />;
}
Para conteúdo aninhado, use a prop especial children.
HTML shell note: App is still mounted into #root by the playground document (import map + Sucrase) — see lesson 1.