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

Functional Components in React

Learn how to create, reuse and compose functional components with practical examples from CIIT Training Institute.

Beginner Friendly Practical Examples Expected Output Included

01 Learning Objectives

After completing this lesson, you will be able to:

01
Create Functional Components

Write components using functions and arrow functions.

02
Render JSX

Return headings, paragraphs, lists and other UI elements.

03
Use Props

Pass student names and course details to components.

04
Reuse Components

Build reusable UI instead of repeating the same code.

02 What Is a Functional Component?

A Functional Component is a JavaScript function that returns React elements, usually written using JSX. Component names should begin with an uppercase letter.

Remember: A functional component is a function, and you use it in JSX with a tag such as <Welcome />.
Welcome.jsx JSX
function Welcome() {
    return (
        <div>
            <h2>Welcome to CIIT Training Institute!</h2>
            <p>Learn React step by step.</p>
        </div>
    );
}

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

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

export default App;
Expected Browser Output

Welcome to CIIT Training Institute!

Learn React step by step.

03 Functional Component Flow Diagram

The parent component App can render child components. Each component is responsible for returning its own UI.

CIIT TRAINING INSTITUTE — COMPONENT STRUCTURE
PARENT COMPONENT App() Application entry UI
CHILD Header() Page heading
CHILD CourseList() Course information
CHILD Footer() Footer information
App renders Header, CourseList and Footer. These are separate components that can be maintained independently.
App.jsx JSX
function Header() {
    return <h2>CIIT Training Institute</h2>;
}

function CourseList() {
    return (
        <ul>
            <li>React JS</li>
            <li>.NET Full Stack</li>
            <li>Python</li>
        </ul>
    );
}

function Footer() {
    return <p>Learn. Practice. Build Projects.</p>;
}

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

export default App;
Expected Browser Output

CIIT Training Institute

  • React JS
  • .NET Full Stack
  • Python

Learn. Practice. Build Projects.

04 Function Declaration vs Arrow Function

React functional components can be written using either a function declaration or an arrow function.

Function Declaration

StudentOne.jsx
function StudentOne() {
    return (
        <p>Student: Samadhan</p>
    );
}

export default StudentOne;
Expected Output

Student: Samadhan

Arrow Function

StudentTwo.jsx
const StudentTwo = () => {
    return (
        <p>Student: Samiksha</p>
    );
};

export default StudentTwo;
Expected Output

Student: Samiksha

Both styles can create functional components. Choose a consistent style for your project.

05 Functional Components with Props

Props are used to pass data from a parent component to a child component. The same component can display different student information without duplicating its structure.

StudentCard.jsx JSX
function StudentCard({ name, course }) {
    return (
        <div>
            <h3>{name}</h3>
            <p>Course: {course}</p>
        </div>
    );
}

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

function App() {
    return (
        <div>
            <h2>CIIT Student Profiles</h2>

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

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

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

export default App;
Expected Browser Output

CIIT Student Profiles

Samadhan Course: React JS
Samiksha Course: .NET Full Stack
Pradnya Course: Python

06 Component Composition

Component composition means combining smaller components to create a larger UI. It makes React applications easier to organize and maintain.

App
↓
CourseSection
↓
CourseTitle
CourseDetails
App.jsx JSX
function CourseTitle() {
    return <h2>React JS Training</h2>;
}

function CourseDetails() {
    return (
        <p>
            Learn components, JSX and props at CIIT Training Institute.
        </p>
    );
}

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

function App() {
    return <CourseSection />;
}

export default App;
Expected Browser Output

React JS Training

Learn components, JSX and props at CIIT Training Institute.

07 Important Rules and Best Practices

✓

Start component names with an uppercase letter.

✓

Return one parent JSX element or use a Fragment.

✓

Use props to pass data into reusable components.

✓

Keep components focused on a clear responsibility.

✓

Call React Hooks only at the top level of components or custom Hooks.

08 Practice Questions

  1. Create a functional component named InstituteInfo.
  2. Create an arrow-function component that displays your name.
  3. Create a reusable StudentCard using name and course props.
  4. Display Samadhan, Samiksha and Pradnya using one reusable component.
  5. Create a parent component that renders Header, CourseList and Footer.
  6. Build a course section by composing two smaller components.

Summary

Functional Components are JavaScript functions that return React elements and form the building blocks of a React application. They can be written as function declarations or arrow functions. Props allow components to receive data, while component composition combines smaller UI elements into a complete page. At CIIT Training Institute, practise these concepts by creating reusable components for student profiles, course lists and training information.