FREE COURSE | BEGINNER
React Fundamentals
Build interactive interfaces using reusable React components.
Learning objectives
Create JSX components, pass props, manage state, handle events and build a task tracker. Basic HTML, CSS and JavaScript knowledge is recommended.
Each lab runs React 18 in an isolated preview. Edit the App component, then select Run code. Internet access is required. Official React learning guide.
01. Introduction to React
React is a JavaScript library for building user interfaces. A component describes what should appear on screen. React updates the interface when its data changes.
Editable JSX
Live preview
Try it yourself: Change the heading to your own greeting.
02. Setup and JSX
JSX is a syntax extension that lets you describe markup in JavaScript. Use one enclosing element, close every tag, and use className instead of class. These labs load React and Babel automatically. For real projects, use a build tool such as Vite.
Editable JSX
Live preview
Try it yourself: Change the name and arithmetic expression.
03. Reusable Components
Component names start with a capital letter. Compose small components into larger interfaces rather than repeating markup.
Editable JSX
Live preview
Try it yourself: Add another component with a different message.
04. Props
Props are inputs passed from a parent to a child component. Treat props as read-only. Destructuring lets you access individual properties.
Editable JSX
Live preview
Try it yourself: Add a third course with different props.
05. State and Events
State is component memory. useState returns the current value and a setter. Event handlers respond to user actions; updating state requests a new render. Use a functional updater when the next value depends on the previous one.
Editable JSX
Live preview
Try it yourself: Add a button that subtracts one.
06. Conditional Rendering and Lists
Use JavaScript conditions to choose what to render. Use map to transform arrays into elements. Each sibling in a rendered list needs a stable, unique key.
Editable JSX
Live preview
Try it yourself: Add another course, then try an empty array.
07. Forms and Controlled Inputs
A controlled input receives its value from state and updates that state through onChange. Prevent the default form submission when handling a form entirely in React.
Editable JSX
Live preview
Try it yourself: Add a second controlled input for a favorite subject.
08. Interactive Practice Lab
Combine props, state and events. Predict what happens before running the code. State belongs to each instance of a component.
Editable JSX
Live preview
Try it yourself: Explain why the two buttons change independently.
09. Mini Project: Learning Task Tracker
Build a small task tracker using controlled input, immutable array updates, stable keys and conditional rendering. The tasks are stored in memory and reset when the preview reloads.
Editable JSX
Live preview
Try it yourself: Add a task count and test blank input, adding and removing tasks.