

Lesson 01 · 10 min
Component and JSX
UI is a function that returns markup. Not an HTML string, but a tree of elements.
10 minLesson 1 of 8Practice includedAsk AI on any point
In React a piece of the screen is a function. It receives data and returns JSX: it looks like HTML, but it's JavaScript. The compiler (usually via Vite) turns <h1>Hello</h1> into a React.createElement call. At runtime these are objects, not a template file like in old PHP.
- A component name starts with a capital letter:
Hello, nothello. Otherwise React decides it's an HTML tag. - The
classattribute in JSX isclassName.foron a label ishtmlFor. - A handler is a function:
onClick={() => save()}, not the stringonclick="save()".
Check
Lock it in before you move on
1. Why can't you
return <h1 /><p />without a wrapper?2. Why is a component called
Cardand notcard?3. How do you insert the variable title into the markup?