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

Introduction to React Components

Learn how React components help you build reusable, organized, and maintainable user interfaces for CIIT Training Institute.

1. What Are React Components?

A React component is a reusable piece of a user interface. It can represent a heading, student card, navigation bar, course section, or an entire page.

Components help developers divide a large application into smaller and easier-to-manage parts.

Example: On the CIIT Training Institute website, the Header, CourseCard, StudentProfile, and Footer can each be separate React components.
App.jsx JSX
function App() {
    return (
        <div>
            <h1>CIIT Training Institute</h1>
            <p>Learn programming step by step.</p>
        </div>
    );
}

export default App;

Expected Output

Browser Output

CIIT Training Institute

Learn programming step by step.

2. React Component Diagram

A page can be divided into smaller components. The main App component can combine a Header, CourseList, and Footer.

App Main Application
Header Institute name
CourseList Available courses
ComponentStructure.jsx JSX
function Header() {
    return <h1>CIIT Training Institute</h1>;
}

function CourseList() {
    return <p>Explore our programming courses.</p>;
}

function Footer() {
    return <footer>Learn. Practice. Grow.</footer>;
}

function App() {
    return (
        <div>
            <Header />
            <CourseList />
            <Footer />
        </div>
    );
}

export default App;

Expected Output

Browser Output

CIIT Training Institute

Explore our programming courses.

Learn. Practice. Grow.

3. Creating Your First Component

To create a functional component, define a JavaScript function that returns JSX. Component names should begin with an uppercase letter.

StudentProfile.jsx JSX
function StudentProfile() {
    return (
        <div>
            <h2>Samadhan</h2>
            <p>Course: React JS</p>
            <p>Institute: CIIT Training Institute</p>
        </div>
    );
}

export default StudentProfile;

You can render this component inside another component using <StudentProfile />.

App.jsx JSX
import StudentProfile from "./StudentProfile";

function App() {
    return (
        <div>
            <h1>Student Dashboard</h1>
            <StudentProfile />
        </div>
    );
}

export default App;

Expected Output

Browser Output

Student Dashboard

Samadhan

Course: React JS

Institute: CIIT Training Institute

4. Why Are Components Reusable?

A reusable component can be used multiple times. Instead of writing the same student card markup repeatedly, you can create a component and reuse it.

StudentCard.jsx JSX
function StudentCard({ name, course }) {
    return (
        <div className="student-card">
            <h3>{name}</h3>
            <p>Course: {course}</p>
            <p>CIIT Training Institute</p>
        </div>
    );
}

export default StudentCard;
App.jsx JSX
import StudentCard from "./StudentCard";

function App() {
    return (
        <div>
            <h2>Our Students</h2>

            <StudentCard
                name="Samadhan"
                course="React JS"
            />

            <StudentCard
                name="Samiksha"
                course=".NET Full Stack"
            />

            <StudentCard
                name="Pradnya"
                course="Python"
            />
        </div>
    );
}

export default App;

Expected Output

Browser Output

Our Students

Samadhan

Course: React JS

CIIT Training Institute

Samiksha

Course: .NET Full Stack

CIIT Training Institute

Pradnya

Course: Python

CIIT Training Institute

5. Component Naming Rules

React components should use PascalCase names. This means each word starts with a capital letter.

Name Valid? Reason
StudentCard Yes Starts with an uppercase letter.
CourseList Yes Uses PascalCase.
studentCard No, for a custom component Starts with a lowercase letter.
course-list No, for a component name Hyphenated names are not component identifiers.
Important: Lowercase JSX tags such as div represent built-in elements. Use uppercase names for your own React components.

6. Component Composition

Component composition means combining smaller components to build a larger user interface.

CourseSection.jsx JSX
function CourseHeading() {
    return <h2>CIIT Training Institute Courses</h2>;
}

function CourseDetails() {
    return (
        <div>
            <p>React JS</p>
            <p>.NET Full Stack</p>
            <p>Python</p>
        </div>
    );
}

function CourseSection() {
    return (
        <section>
            <CourseHeading />
            <CourseDetails />
        </section>
    );
}

export default CourseSection;

Expected Output

Browser Output

CIIT Training Institute Courses

React JS

.NET Full Stack

Python

7. React Components Best Practices

  • Give each component a clear and meaningful name.
  • Keep components focused on a specific responsibility.
  • Reuse components instead of repeating the same markup.
  • Use props to pass data to reusable components.
  • Keep JSX indentation consistent and readable.
  • Export and import components using the appropriate syntax.
  • Use CIIT Training Institute branding consistently across institute pages.

8. Practice Questions

  1. Create a component that displays CIIT Training Institute's name.
  2. Create a StudentProfile component for Samadhan.
  3. Build one reusable StudentCard component for Samiksha and Pradnya.
  4. Create separate Header, CourseList, and Footer components.
  5. Combine three smaller components inside an App component.
  6. Explain why custom component names should start with uppercase letters.

Summary

React components are reusable building blocks for user interfaces. They allow CIIT Training Institute pages to be divided into smaller parts such as headers, course lists, and student cards. Components can be combined through composition, reused with different data, and organized with clear naming conventions. Functional components return JSX and can receive props to display dynamic information for students such as Samadhan, Samiksha, and Pradnya.