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

What Is React?

Understand React, how it works, why developers use it, and how React components help build interactive web applications.

Learning objective: By the end of this lesson, you will understand React's purpose, components, declarative UI, and how React updates the screen.

1. What Is React?

React is an open-source JavaScript library for building user interfaces. It allows developers to divide a webpage into small, reusable components.

A component can represent a navbar, course card, registration form, student profile, or any other part of a user interface. These components can be combined to build a complete application.

For example, a CIIT Training Institute website can use separate components for courses, student enquiries, contact details, and navigation menus.

In simple words: React helps us build a website by creating small UI parts and combining those parts into a complete webpage.

2. How Does React Work?

This simplified diagram shows how React components use data to describe the user interface.

📦
Components

Define reusable interface sections.

→
📊
Props and State

Supply component data and changing values.

→
🖥️
Rendered UI

React updates the screen when necessary.

Important: Props and state are not the only inputs that can affect rendering. Context and other component dependencies can also influence the UI.

3. Understanding Components

Components are the building blocks of a React application. A function component is a JavaScript function that returns React elements, commonly described using JSX.

🧭
Navbar Component

Displays navigation links such as Home, Courses, About Us, and Contact.

🎓
Course Component

Displays an individual course name, description, duration, and details.

📝
Form Component

Provides input fields for students to submit their enquiries.

📞
Footer Component

Displays contact details, useful links, and other footer information.

4. Practical Example: Create a React Component

Let's create a simple component that displays a welcome message.

Step 1: Create Welcome.jsx

function Welcome() {
    return (
        <h1>Welcome to CIIT Training Institute!</h1>
    );
}

export default Welcome;

Step 2: Use It in App.jsx

import Welcome from "./Welcome";

function App() {
    return (
        <div>
            <Welcome />
        </div>
    );
}

export default App;

Expected Output

Welcome to CIIT Training Institute!

Explanation:
  • function Welcome() defines a component.
  • return describes the content to display.
  • export default exports the component.
  • import Welcome imports the component into another file.
  • <Welcome /> renders the component inside App.

5. React vs a Traditional HTML Page

Traditional HTML and JavaScript React
Developers can update DOM elements directly. Developers describe the UI using components and data.
Reusable UI patterns must be organised manually. Components provide a reusable UI structure.
UI updates can involve manually managing DOM changes. React manages rendering and DOM updates for the UI it controls.
Can be a good choice for simple static pages. Can be useful for interactive, component-based applications.
Remember: React is not a replacement for HTML or JavaScript. React uses JavaScript and commonly JSX to build user interfaces based on HTML elements.

6. Where Is React Used?

E-Commerce Websites

Product listings, shopping carts, filters, and checkout interfaces.

Training Portals

Course listings, student dashboards, and enquiry forms.

Admin Dashboards

Data tables, charts, forms, and interactive reports.

Social Applications

Feeds, user profiles, notifications, and interactive controls.

Summary

  • React is a JavaScript library for building user interfaces.
  • Components divide an interface into reusable parts.
  • Props pass data to components.
  • State represents changing information in a component.
  • JSX provides a convenient syntax for describing UI elements.
  • React is used to build interactive web applications.