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

Uses of React

Learn where React is used in real-world applications, from training portals and admin dashboards to e-commerce websites and interactive forms.

Learning objective: Understand common React use cases and learn how reusable components, props, and state help build interactive applications.

1. Where Is React Used?

React is a JavaScript library used to build user interfaces. It is useful when an application needs reusable UI components, interactive elements, or screens that change when data changes.

For example, CIIT Training Institute could use React to create course listings, student dashboards, enquiry forms, online learning pages, and interactive assessment screens.

In simple words: React can be used whenever you need to create a user interface made of reusable parts and dynamic content.

2. React in a Real-World Application

The following diagram shows examples of application areas in which React components can be useful.

🎓
Training Portal

Courses, student profiles, and learning progress.

🛒
E-Commerce

Products, shopping carts, and filters.

📊
Admin Dashboard

Tables, metrics, charts, and reports.

📝
Online Forms

Registration, validation, and submission.

↓
🧩
Reusable React Components

Each application can organize its interface into components suited to its requirements.

Remember: These are examples of possible use cases, not ready-made applications provided automatically by React.

3. Use Case: Training Institute Website

A training institute can use React to display courses, course durations, descriptions, and enrolment links. A reusable component makes it easier to present multiple courses with the same layout.

React Code

interface Course {
    id: number;
    name: string;
    duration: string;
}

const courses: Course[] = [
    { id: 1, name: "React", duration: "3 months" },
    { id: 2, name: "Python", duration: "4 months" },
    { id: 3, name: ".NET", duration: "4 months" }
];

function CourseList() {
    return (
        <section>
            <h2>Our Courses</h2>

            {courses.map(course => (
                <article key={course.id}>
                    <h3>{course.name}</h3>
                    <p>Duration: {course.duration}</p>
                </article>
            ))}
        </section>
    );
}

export default CourseList;

Expected Output

Our Courses

React

Duration: 3 months

Python

Duration: 4 months

.NET

Duration: 4 months

Explanation:
  • The Course interface defines the course data structure.
  • The courses array contains sample course records.
  • map() creates UI elements for the course records.
  • key helps React identify each item in the rendered list.

4. Use Case: E-Commerce Website

React can be used to build product listings, search filters, shopping carts, and interactive product details. State is useful when the quantity of an item changes.

Example: Product Information

interface Product {
    id: number;
    name: string;
    price: number;
}

const product: Product = {
    id: 101,
    name: "Keyboard",
    price: 1200
};

function ProductCard() {
    return (
        <article>
            <h3>{product.name}</h3>
            <p>Price: ₹{product.price}</p>
            <button>Add to Cart</button>
        </article>
    );
}

export default ProductCard;

Expected Output

Keyboard

Price: ₹1200

Static preview only. The button is illustrative and does not add an item to a real shopping cart.

Explanation: The product object stores structured data, and the component displays that data in a consistent layout. A full shopping cart would also need state management and suitable checkout logic.

5. Use Case: Admin Dashboard

Admin dashboards often show summaries, tables, activity indicators, and reports. React components can separate each dashboard section so that the data and presentation remain organized.

👨‍🎓

Total Students

250

📚

Available Courses

12

📝

New Enquiries

18

✅

Completed Batches

8

Important: The numbers above are sample values for the tutorial design, not real CIIT Training Institute statistics.

6. Use Case: Student Registration Form

React is useful for interactive forms that collect user information, validate fields, and display messages as data changes.

React Code

import { useState } from "react";

function StudentForm() {
    const [name, setName] = useState("");

    function handleSubmit(
        event: React.FormEvent<HTMLFormElement>
    ) {
        event.preventDefault();

        if (name.trim() === "") {
            alert("Please enter your name.");
            return;
        }

        alert("Welcome, " + name + "!");
    }

    return (
        <form onSubmit={handleSubmit}>
            <label htmlFor="studentName">
                Student Name
            </label>

            <input
                id="studentName"
                value={name}
                onChange={event => setName(event.target.value)}
            />

            <button type="submit">Register</button>
        </form>
    );
}

export default StudentForm;

How It Works

⌨️
Enter Name

The student types into the input field.

🔍
Validate

The submit handler checks the name.

✅
Show Result

A message is shown for the entered value.

Remember: This sample uses a browser alert to demonstrate the flow. A real registration system also needs server-side validation, data persistence, and appropriate error handling.

7. Other Applications of React

💬
Messaging Interfaces

Display conversation lists, messages, notifications, and user status.

🎬
Media Applications

Build media listings, filters, playback controls, and profile interfaces.

📈
Reporting Tools

Display tables, visual summaries, filters, and data-driven reports.

📖
Learning Platforms

Build lesson lists, quizzes, progress screens, and interactive learning activities.

8. Application Requirements and React Features

Application Possible React Features Example Component
Training Portal Components, props, lists CourseCard
E-Commerce State, events, conditional rendering ShoppingCart
Admin Dashboard Reusable components and data rendering StatisticsCard
Registration Form State, events, and validation StudentForm
Learning Platform Routing, state, and lists LessonList

Summary

  • React can build course portals and learning management interfaces.
  • E-commerce applications can use state and events for interactive shopping features.
  • Dashboards can use reusable components to display data summaries.
  • Forms can use state and event handlers to manage user input.
  • Lists and props help render collections of courses or products.
  • The right component structure depends on each application's requirements.