Master React From Scratch

Clear, practical, and structured React lessons designed for beginners and developers.

COURSE SYLLABUS
1. Introduction to React
Introduction to React What Is React? Features of React Advantages of React Limitations of React Uses of React React vs JavaScript React Architecture
2. React Getting Started
Getting Started Introduction Prerequisites Installing Node.js and npm Creating a React Project with Vite React Project Structure Running React Application Your First React Application
3. JSX
JSX Introduction What Is JSX? JavaScript Expressions JSX Attributes Rendering JSX Elements JSX Children React Fragments JSX Rules and Best Practices JSX vs HTML
4. React Components
Components Introduction Functional Components Class Components Component Composition Reusable Components Component Tree Component Lifecycle Import and Export Components
5. React Props
Props Introduction What Are Props? Passing Props to Components Props Destructuring Default Props Values Children Props Typing Props with TypeScript Props vs State
6. React State
State Introduction What Is State? useState Hook Updating State Functional State Updates State with Objects State with Arrays State Immutability Lifting State Up
7. React Events
Events Introduction Handling Events Passing Arguments to Event Handlers Synthetic Events Form Events Keyboard and Mouse Events Event Propagation
8. Conditional Rendering
Conditional Rendering Introduction If-Else Rendering Ternary Operator Logical AND Operator Element Variables Preventing Rendering Multiple Conditions Conditional CSS Classes
9. Lists and Keys
Lists and Keys Introduction Rendering Lists with map() Understanding Keys Choosing Unique Keys Lists of Objects Filtering Lists Sorting Lists Empty Lists and Conditional Rendering
10. React Forms
Forms Introduction Handling Forms Controlled Components Uncontrolled Components Handling Input Fields Checkboxes and Radio Buttons Select and Textarea Form Validation Form Submission
11. React Hooks
Hooks Introduction useState Hook useEffect Hook Effect Dependencies and Cleanup useRef Hook useReducer Hook useMemo Hook useCallback Hook Custom Hooks Rules of Hooks
12. React Context API
Context API Introduction createContext useContext Context Provider Reading Context Updating Context Using Multiple Contexts Context API vs Props Context API Best Practices
13. React Routing
Routing Introduction Introduction to React Router Installing React Router BrowserRouter Setup Routes and Route Components Link and NavLink Programmatic Navigation URL Parameters and useParams Nested Routes Not Found Routes Protected Routes
14. API Integration
API Integration Introduction Fetch API Async/Await with API Calls Displaying API Data Loading and Error States Sending POST Requests API Error Handling Using Axios Custom Fetch Hook API Environment Variables
15. State Management
State Management Introduction Global State Prop Drilling Introduction to Redux Redux Core Concepts Redux Toolkit Store and Slices useSelector and useDispatch Async Operations with Redux Toolkit State Management Best Practices
16. React Performance
Performance Introduction Understanding Re-Renders Avoiding Unnecessary Re-Renders React.memo useMemo Optimization useCallback Optimization React Developer Tools and Profiler Lazy Loading Components Code Splitting Optimizing Large Lists Performance Best Practices

Getting Started with React

Learn what you need before starting React development, how to create a React project, and how to run your first application.

1. Introduction to React Getting Started

Before developing a React application, we need to prepare our development environment. This includes installing the required tools, creating a project, understanding its folder structure, and running the application in a browser.

In this module, we will use React to build the user interface and Vite to create and run the development project.

What you will learn: By the end of this module, you will understand how to prepare your computer for React development and run a basic React app.

2. What Do You Need to Start React?

JS

JavaScript

React uses JavaScript to define components, work with data, handle events, and create dynamic UIs.

Programming Language
N

Node.js

Node.js provides a JavaScript runtime used by development tools and many React project commands.

JavaScript Runtime
npm

npm

npm helps install and manage the packages required by a React project.

Package Manager
</>

Code Editor

Visual Studio Code or another code editor helps you create, edit, and organize project files.

Development Tool
Also required: A modern web browser, such as Google Chrome or Microsoft Edge, to view and test your React application.

3. React Development Setup Flow

Follow these steps in sequence to get your first React development environment ready.

1

Install Node.js

Install Node.js and npm on your computer.

Prerequisite
↓
2

Create a React Project

Use Vite to generate a React project.

Project Setup
↓
3

Install Dependencies

Install the packages required by the project.

Dependencies
↓
4

Run the Application

Start the development server and open the app.

Development
↓
✓

React App Running

Your application is ready to view in the browser.

4. Understanding the Tools

Tool Purpose Example
React Builds user interfaces using components. Course cards, forms and navigation.
Node.js Runs JavaScript outside the browser and supports development tools. Running project tooling.
npm Installs and manages project dependencies. npm install
Vite Creates the project template and provides a development server. npm run dev
VS Code Used to edit and manage source files. Editing App.jsx.

5. Basic Commands You Will Use

After Node.js is installed, open Command Prompt or the VS Code terminal and run the following commands to check your environment.

Check Node.js Version

Terminal Command
node --version

This command displays the installed Node.js version.

Check npm Version

Terminal Command
npm --version

This command displays the installed npm version.

Expected Output

v22.x.x
10.x.x

These are example version formats only. Your actual version numbers may be different.

Important: If the commands are not recognized, check whether Node.js is installed correctly and reopen your terminal.

6. Preview: Creating a React Project

In the upcoming lessons, we will create a project using Vite. The following commands show the overall process.

Terminal Vite + React
npm create vite@latest my-react-app -- --template react
cd my-react-app
npm install
npm run dev
npm create vite@latest

Starts the Vite project creation tool.

cd my-react-app

Moves into the newly created project folder.

npm install

Installs the project's required packages.

npm run dev

Starts the development server using the project's script.

Expected Result

The terminal displays a local development URL, commonly:

http://localhost:5173/

Open the URL shown in your own terminal. The port can differ if the default port is already in use.

We will explore these commands step by step in the next lessons.

7. What Will You Learn in This Module?

01

Getting Started Introduction

Understand the React setup process.

02

Prerequisites

Learn what is required before installing React tools.

03

Installing Node.js and npm

Install and verify the development environment.

04

Creating a React Project with Vite

Generate a React project from the terminal.

05

React Project Structure

Understand important folders and files.

06

Running React Application

Start the development server and open the app.

07

Your First React Application

Build and understand your first working component.

Summary

  • React is used to build component-based user interfaces.
  • Node.js and npm support the React development workflow.
  • Vite helps create and run a React project.
  • A code editor helps you write and manage source files.
  • The development server lets you view your application in a browser.
  • The following lessons will explain each setup step in detail.