Your first component
Fill-gap25 min
Your first component
A component is a function that returns markup:
function ProductCard({ title, price }) {
return (
<article className="card">
<h3>{title}</h3>
<p>{price} USD</p>
</article>
);
}
// using it
<ProductCard title="Notebook" price={3.5} />JSX looks like HTML but is JavaScript: {curly braces} drop into any expression, className replaces class, and every tag must close. The component name starts with a capital letter — lowercase names are treated as HTML tags.
Exercise
Write a LessonRow component that takes title and minutes and renders a list item like "Selectors & the box model — 25 min".