
Start learning React by writing real code. We create a project with Vite, tour the three files that matter, delete the starter code and write our first component from scratch.
Commands: npm create vite@latest my-first-app -- --template react, then cd my-first-app, npm install and npm run dev.
The finished code for this lecture is attached as a downloadable resource.
JSX looks like HTML but it is JavaScript in disguise. Five rules, one small example, and the most common beginner mistake (forgetting the curly braces). The finished code for this lecture is attached as a downloadable resource.
Break one big component into small reusable pieces. Why the capital letter matters, one component per file, export and import, and components inside components. The finished code for this lecture is attached as a downloadable resource.
One Card component, three different people. Passing and receiving props, the "81 years" string bug, destructuring, default values and the children prop. The finished code for this lecture is attached as a downloadable resource.
Why a normal variable can't update the screen, and how useState fixes it. We build a counter and walk through exactly what happens on every click. The finished code for this lecture is attached as a downloadable resource.
How React listens to clicks and typing. Named handlers, inline arrow functions, the event object, and the two mistakes every beginner makes. The finished code for this lecture is attached as a downloadable resource.
Show different things in different situations. The three tools React developers use, when to pick each one, and the famous "0 on the page" bug. The finished code for this lecture is attached as a downloadable resource.
Turn an array of data into a list on the screen with map, understand what keys are for, choose good keys, and handle the empty list. The finished code for this lecture is attached as a downloadable resource.
Who owns the text in an input: the browser or your state? We build a sign-up form, see the bug an uncontrolled input causes, and fix it with value and onChange. Plus onSubmit, preventDefault and a disabled button. The finished code for this lecture is attached as a downloadable resource.
Two components need the same number, but siblings can't talk to each other. We lift the state to the parent, pass the value down and a function down, and see "data down, events up" in action. The finished code for this lecture is attached as a downloadable resource.
Four ways to style a React component and when to use each. We style a profile card, make a button change its look from state, and see why CSS Modules exist. The finished code for this lecture is attached as a downloadable resource.
What a side effect is, when an effect runs, and why your timer goes crazy or counts in twos. We fix both bugs with the dependency array and a cleanup function. The finished code for this lecture is attached as a downloadable resource.
Our app talks to the internet for the first time. API, fetch, JSON and async/await in plain English, then we load real users and avoid the request loop and the "cannot read properties of undefined" crash. The finished code for this lecture is attached as a downloadable resource.
Make data fetching production-ready. A loading message, an honest error message, the fetch trap with server errors, and a Try again button. The finished code for this lecture is attached as a downloadable resource.
The two jobs of useRef. Reach a real element to focus it, and keep a value that survives re-renders without causing one. Plus a clear experiment showing state vs ref. The finished code for this lecture is attached as a downloadable resource.
Put fifteen lectures together in one project. Add, tick off and delete tasks, show progress, and save everything to localStorage. Learn the key rule for lists in state: never change state directly. The finished code for this lecture is attached as a downloadable resource.
Components reuse UI; custom hooks reuse logic. We extract a useToggle hook, see why each call gets its own state, then build a useLocalStorage hook that is a drop-in replacement for useState. The finished code for this lecture is attached as a downloadable resource.
Passing the same prop through components that don't use it is called prop drilling. We fix it with Context in three steps, hit the classic "no provider" crash on purpose, and learn when props are still the better choice. The finished code for this lecture is attached as a downloadable resource.
When state changes in many ways, a reducer puts all the rules in one place. We convert a small cart from useState to useReducer, fix the mutation bug, and see when a reducer is worth it. The finished code for this lecture is attached as a downloadable resource.
Give your single-page app multiple pages. Install React Router, define routes, see why a plain anchor tag reloads the whole app, read values from the address bar with useParams, and add a not-found page. The finished code for this lecture is attached as a downloadable resource.
The newer way to build forms that send data. A form action as a function, FormData, a pending state for free, error handling by return value, and a reusable submit button. Includes the "Thanks, null!" bug. The finished code for this lecture is attached as a downloadable resource.
We make an app slow on purpose, find out why, and fix it. Why children re-render, how memo skips work, how a function prop silently breaks it, and what the React Compiler changes. The finished code for this lecture is attached as a downloadable resource.
Load parts of your app only when they're needed, and stop one broken component from blanking the whole page. Real build output before and after code splitting, plus an error boundary in action. The finished code for this lecture is attached as a downloadable resource.
Catch bugs while you type. Create a TypeScript project, type your props, see the "81 years" bug caught in the editor, optional props, inferred state, and event types. The finished code for this lecture is attached as a downloadable resource.
A flat src folder stops working fast. We sort a real project into components, pages, hooks, context, api and utils, break an import on purpose and read the error, and finish with five rules of thumb and the feature-folder layout for big apps. The finished code for this lecture is attached as a downloadable resource.
Your first component tests. We install Vitest and React Testing Library, test what a Counter renders and what happens on a click, then break the component on purpose to see a test catch it. The finished code for this lecture is attached as a downloadable resource.
Server data is a copy, and copies go out of date. We replace our hand-written fetch, loading and error code with useQuery, add the provider, and watch the cache make a second visit instant. The finished code for this lecture is attached as a downloadable resource.
A login flow with Context and React Router. We keep the user in a context, navigate after login, hit the crash that every unguarded page has, then build a Protected route with Navigate and Outlet. Ends with an honest note on what a front-end guard does not secure. The finished code for this lecture is attached as a downloadable resource.
The start of the final project. We plan the app with four questions, create a fresh Vite project, build a layout route with NavLink and Outlet, add nested and dynamic routes, load data through a custom hook, and fix the classic route-param bug. The finished code for this lecture is attached as a downloadable resource.
We finish the watchlist app: shared state with Context, saving to localStorage with our own hook, search with derived data, and empty states. Then we build for production, deploy, and fix the refresh-404 trap that catches every single-page app. The finished code for this lecture is attached as a downloadable resource.
This course contains the use of artificial intelligence.
React from Scratch takes you from your very first component to a complete app deployed on the internet, using React 19 and Vite.
Every lecture is live coding. You watch the code being written line by line, you see the real error messages beginners hit, and you learn how to read them and fix them. Each lecture ends with a short recap and a small challenge so you can practise on your own.
What makes this course different:
What you will cover:
The course has 30 lectures in 10 sections, about 4 hours and 20 minutes of video, with English captions on every lecture.
How this course was made: AI tools were used to create it. The narration is an AI-generated voice, and AI helped write the scripts, the code examples and the visuals. All the code was tested with React 19 and Vite. If you get stuck, ask in the Q&A.
Who this course is for: anyone who knows basic JavaScript and wants to learn modern React properly, from zero to a deployed app.