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

Installing Node.js and npm

Learn how to download Node.js, install it on Windows, verify npm, and prepare your system for React development.

1. Introduction

Node.js is a JavaScript runtime that allows JavaScript to run outside a web browser. React development tools use Node.js to perform tasks such as running the development server and building applications.

npm stands for Node Package Manager. It helps install and manage packages required by a project.

Remember: When you install Node.js using the standard official Windows installer, npm is normally installed along with it. You can verify both tools using terminal commands.

2. How Node.js and npm Work Together

Your Computer

Windows Operating System

Environment for development tools

↓

Node.js

Runs JavaScript development tools

npm

Installs and manages packages

Vite

Runs the React development server

↓

React Application

Open and test your application in a browser

Diagram: A simplified development workflow. npm and Vite are separate tools; Vite can be installed as a project dependency through npm.

3. Download Node.js

Download Node.js from its official website. For a new learning environment, choose the version marked LTS (Long-Term Support), unless your project requires a different version.

N

Node.js Official Download

Choose the Windows installer appropriate for your computer.

Download Node.js ↗
1

Open the Official Website

Visit the Node.js download page using the button above.

2

Select the LTS Version

Choose the release marked LTS for a stable learning environment.

3

Select Windows Installer

For most Windows computers, choose the Windows Installer (.msi) that matches your system architecture.

4

Wait for the Download

Once the installer has downloaded, open it to begin the installation.

Important: Use the official Node.js website rather than downloading an installer from an unknown source.

4. Install Node.js on Windows

Follow these steps after downloading the Windows installer.

1

Run the Installer

Open the downloaded .msi file. If Windows requests permission, review the prompt before continuing.

Example file format: node-vXX.X.X-x64.msi
2

Welcome Screen

Read the installation information and click Next.

3

Accept the License Agreement

Read the license terms. Accept them if you agree, then continue to the next screen.

4

Choose the Installation Location

The default installation folder is suitable for most learners. Keep it unless you have a specific reason to change it.

5

Check the Setup Features

Keep the standard features selected, including npm package manager and the option to add Node.js to PATH when provided by the installer.

PATH allows commands such as node and npm to run from a terminal.
6

Click Install

Start the installation and approve any required Windows permission prompts.

7

Finish the Installation

Wait for the installer to finish and click Finish.

Note: Installer screens can differ slightly between Node.js releases. Follow the options shown by the installer on your computer.

5. Reopen Your Terminal

After installation, close any old Command Prompt, PowerShell, or VS Code terminal windows. Open a new terminal so it can pick up updated environment variables such as PATH.

CMD

Command Prompt

Press the Windows key, type cmd, and open Command Prompt.

PS

PowerShell

Search for PowerShell from the Windows Start menu and open it.

>_

VS Code Terminal

Open VS Code, then select Terminal → New Terminal.

6. Verify Node.js Installation

Run the following command in the new terminal.

Terminal Node.js
node --version

If Node.js is installed correctly and available on PATH, the terminal displays a version number.

Example Output

v24.x.x

Your installed version may differ. The x characters here represent version digits in an example.

✓

Node.js Command Recognized

A displayed version indicates that the terminal can find the Node.js executable.

7. Verify npm Installation

Now check whether npm is installed and available.

Terminal npm
npm --version

If npm is available, this command displays its version.

Example Output

10.x.x

The output depends on the npm version included with your Node.js installation.

Remember: Node.js and npm have separate version numbers. It is normal for their version numbers to be different.

8. Useful npm Commands

These commands will be helpful as you work on React projects.

Command Purpose
npm --version Displays the installed npm version.
npm help Displays npm help information.
npm install Installs the dependencies listed by a project.
npm run Lists the available scripts defined in the current project's package.json.
npm run dev Runs the development script if the current project defines it.
Important: Commands such as npm install and npm run dev should normally be run from the appropriate project directory.

9. Common Errors and Solutions

Error Possible Cause Solution
node is not recognized Node.js is missing or its location is not available on PATH. Check the installation and PATH, then reopen the terminal.
npm is not recognized npm is missing or the terminal cannot find it. Check the Node.js installation and reopen the terminal.
npm install fails Network, permissions, or dependency errors. Read the complete error message and check the network and project folder.
Old version appears A different installation may be found first on PATH. Check the active executable location and remove conflicting PATH entries carefully.
Installer cannot run Incomplete download or an installer that does not match the system. Download the appropriate installer again from the official website.

Debugging Tip

First, run node --version and npm --version in a newly opened terminal. If either fails, resolve the installation or PATH issue before creating the React project.

10. Practice Task

Complete this practical exercise before moving to the next lesson.

Task: Verify Your Development Environment

  1. Download the Node.js LTS installer from the official website.
  2. Install Node.js using the standard installation options.
  3. Open a new terminal.
  4. Run node --version.
  5. Run npm --version.
  6. Confirm that both commands display version numbers.

Summary

  • Download Node.js from the official website.
  • Choose the LTS release for a stable learning environment.
  • Install Node.js using the Windows installer.
  • npm is normally included with the standard installation.
  • Use node --version to verify Node.js.
  • Use npm --version to verify npm.
  • Open a new terminal if the commands are not recognized.