What React is, your first components, JSX, and JavaScript inside JSX.
Your first componentTry itA component is a function with a capital name that returns JSX. createRoot(...).render(<App />) shows it.
A heading and a paragraphExerciseSeveral lines of JSX go inside return ( ... ), wrapped in one parent element.
JavaScript inside JSXExercise{ } in JSX shows the value of any JavaScript expression: a variable, a sum, a function call.
Two elements, no parentDebugReturn one parent element. <> ... </> (a fragment) groups elements without an extra div.
Quick checkQuizComponents, JSX, { } for JavaScript values, and one parent element.
2. The rules of JSX
className, styles as objects, and why every tag must close.
className, not classExerciseIn JSX, className sets the CSS class (because class is a JavaScript word).
Style with an objectExercisestyle={{ ... }} takes an object with camelCase names: fontSize, backgroundColor...
The image that broke the pageDebugIn JSX every tag closes. Tags with no content close themselves: <img />, <input />, <br />.
Quick checkQuizclassName, style objects with camelCase, and closing every tag.
3. Props
Pass data into components, reuse them, and fill them with children.
A component with propsExerciseProps pass data into a component: <Greeting name="Nova" /> and function Greeting({ name }).
Player cardsExerciseText props go in quotes, everything else in braces: level={12}.
A panel with childrenExercisechildren is what is written between a component's tags. Show it with {children}.
The greeting that vanishedDebugComponent names must start with a capital letter; lowercase names are HTML tags.
Quick checkQuizProps pass data in, numbers in braces, children between the tags, and capital component names.
4. Lists and keys
Turn arrays into lists with map, give every item a key, and filter what to show.
A list with mapExercisearray.map(item => <li key={...}>...</li>) turns data into a list. Every item needs a unique key.
A scoreboardExerciseMap a list of objects, and use each object's id as its key.
Only the bestExercise.filter(test).map(...) shows only the items you want.
The warning in the ConsoleDebugEvery item made by .map() needs a unique, stable key, like an id.
Quick checkQuizmap, keys and filter.
5. State and events
Make pages that react to clicks: useState, onClick, counters and switches.
A counterExerciseuseState gives a value and its setter; onClick runs code on a click; setting state redraws.
A light switchExerciseA true/false state with ! to flip it, and condition ? a : b to choose what to show.
Plus and minusExerciseSeveral buttons can change the same state, each with its own onClick.
The counter that does not countDebugOnly state changes make React redraw. Plain variables are forgotten on every draw.
Quick checkQuizuseState, setters that redraw, onClick, and the ? : choice.
6. Forms and input
Fields that follow typing, adding to lists, and forms that send without reloading.
A field that talks backExerciseA field in React: value={state} plus onChange={(e) => setState(e.target.value)}.
Add to the listExerciseAdd to a state list with a new array: setItems([...items, newItem]).
A sign-up formExercise<form onSubmit={...}> with event.preventDefault() handles sending without a page reload.
The item that does not appearDebugDo not change state in place (push, items[0] = ...); give the setter a new array or object.
Quick checkQuizonChange with e.target.value, new arrays with spread, and onSubmit with preventDefault.
7. Conditions and effects
Show things only when needed, and run code after drawing with useEffect: titles and loading data.
Show it only when...Exercise{condition && <X />} shows X only when true; {condition ? a : b} chooses between two.
Your first effectExerciseuseEffect(fn, [deps]) runs fn after drawing, and again when a dependency changes.
Loading dataExerciseLoad data in useEffect(..., []), show a loading state until it arrives, then save it in state.
The mysterious 0DebugBefore && in JSX, use a real true/false (list.length > 0), not a number that can be 0.
Quick checkQuiz&& and ? : for showing, useEffect for work after drawing, and its dependency list.
8. React exam
Ten questions about everything in this course. Pass with 8 right answers.
The React examExamComponents, JSX, props, lists, state, forms and effects.
9. Final project
Build a shopping list app with your own components, state, a form and a list. Then send it for review.
A shopping list appFinal projectComponents, state, lists with keys and forms, together in one app: that is React.
How the course works
You learn by doing: each lesson explains one idea, then you write real code in the editor and see the result right away. The first lesson is free to try without an account; sign up to save your progress and continue.
Try it
Change working code and see the result immediately.
Exercise
Complete a task. A checklist confirms each requirement as you type.
Debug
Fix code that is broken on purpose, and learn why it failed.