React Tutorial
React is a JavaScript library for building user interfaces from reusable pieces called components. It was created at Facebook (now Meta) and powers Facebook, Instagram, Netflix, Shopee's and many other web apps. It's one of the most in-demand skills for web developers.
This free course has 13 lessons. Every example runs live: press Try it yourself, edit the code, and watch your React app update.
Before you start
React is JavaScript, so you should be comfortable with the basics first: variables, functions, arrays, objects and events. Our JavaScript course covers everything you need, especially arrow functions, array methods like map and filter, and destructuring.
What you'll be able to do
- Write JSX and build pages from components
- Pass data with props and remember data with state
- Handle clicks, typing and forms
- Render lists and show content conditionally
- Run side effects with useEffect
- Build a complete grade tracker app
All lessons
Getting Started
- Introduction to ReactWhat React is, why developers use components and state instead of changing the DOM by hand, and your first live React component.
- Getting Started with React — Vite, Node.js and Project StructureSet up a real React project with Node.js and Vite, understand the main files (index.html, main.jsx, App.jsx), run the development server, and build for production.
- React JSX — Writing HTML in JavaScriptLearn JSX rules — one parent element, fragments, className, self-closing tags, camelCase attributes, inline styles, and embedding JavaScript expressions with curly braces.
Components & Props
- React ComponentsBuild user interfaces from function components — create, reuse and nest components, split a page into Header, Main and Footer, and follow naming rules.
- React Props — Passing Data to ComponentsMake components reusable with props — pass strings, numbers, arrays and functions, destructure props, set default values and use the children prop.
State & Events
- React State with useStateRemember changing data with the useState hook — counters, toggles and text — understand re-rendering, update state correctly with the updater function, and store objects and arrays.
- React Events — onClick, onChange and onSubmitRespond to clicks, typing and form submissions in React with onClick, onChange and onSubmit, pass arguments to handlers, and use the event object.
- React Forms — Controlled Inputs, Checkboxes and SelectsBuild forms in React with controlled inputs, one state object for many fields, checkboxes, radio buttons and selects, validation messages and resetting the form.
Lists & Conditions
- React Conditional RenderingShow different content depending on state or props with if statements, the ternary operator, the && operator, and returning null.
- React Lists and KeysRender arrays as lists with map, give each item a stable key, filter and sort before rendering, and render tables from arrays of objects.
Effects & Data
- React useEffect — Timers, Titles and Fetching DataRun side effects with useEffect — update the page title, start and clean up timers, sync with localStorage, and fetch data from an API with loading and error states.
- React — Sharing State Between ComponentsShare data between components by lifting state up to a common parent, pass setter functions as props, avoid prop drilling with Context, and organize state well.
- React Final Project — Grade Tracker AppBuild a complete React grade tracker with components, props, state, forms, validation, lists, filtering, sorting, editing, deleting and computed statistics.