Exambodh - Practice Aptitude, Reasoning & GK Questions
Play Quiz
Start practice
≡One Liner Questions⌂Home?Play QuizAaArticles
General Knowledge›
Indian History›
Indian Polity›
Quantitative Aptitude›
Logical Reasoning›
Interview Practice›
General Science›
Computer Awareness›
View more categories (4)
Current Affairs›
Geography›
NCERT Solutions & Notes›
Static GK›
  1. Home
  2. |Articles
  3. |React Interview Questions and Answers 2026 | SSR, CSR, Hooks, Virtual DOM
←Back to Articles
React jsJavascript

React Interview Questions and Answers 2026 | SSR, CSR, Hooks, Virtual DOM

React js7 May 202615m min read

Share Article

Share on social media or copy your public link.

FacebookWhatsAppLinkedIn

React Interview Guide

React Interview Questions Explained in Easy Way

In this article, we will understand important React interview questions like Virtual DOM, Reconciliation, SSR vs CSR, Hooks, Caching, Lazy Loading, React 19 features, and one practical counter component with validation.

1. What is React Reconciliation? How does Virtual DOM work?

What is Virtual DOM?

Virtual DOM is a lightweight JavaScript copy of the real DOM. React keeps this copy in memory to make UI updates faster.

State changes → New Virtual DOM → Compare with old Virtual DOM → Update only changed part

What is Reconciliation?

Reconciliation is the process where React compares the old Virtual DOM with the new Virtual DOM and updates only the required part of the real DOM.

function App() {
  const [count, setCount] = React.useState(0);

  return (
    <div>
      <h1>Counter</h1>
      <p>{count}</p>
      <button onClick={() => setCount(count + 1)}>
        Increase
      </button>
    </div>
  );
}

When count changes, React does not update the full page. It only updates the changed text inside the paragraph.

Role of Key

Keys help React identify which list item changed, added, or removed.

{items.map(item => (
  <li key={item.id}>{item.name}</li>
))}
Interview Answer: React Reconciliation compares old and new Virtual DOM and updates only the changed parts in the real DOM.

2. What is SSR vs CSR? Which one is faster and why?

CSR: Client-Side Rendering

In CSR, browser downloads JavaScript first, then React renders the UI in the browser.

Browser → Empty HTML → Download JS → Run React → Fetch Data → Show UI

SSR: Server-Side Rendering

In SSR, server prepares the HTML first and sends ready content to the browser.

Browser Request → Server renders HTML → Browser shows ready page

Which is faster?

SSR is usually faster for the first page load because browser receives ready HTML. CSR can feel faster after loading because page interactions happen inside the browser.

Point SSR CSR
Rendering Server Browser
Initial Load Fast Slow
SEO Excellent Weak/Medium
Best For Blogs, SEO pages, product pages Dashboards, apps, admin panels
Interview Answer: SSR is faster for initial load because server sends ready HTML. CSR is slower initially because browser must load and execute JavaScript first.

3. What are React Hooks? Explain useEffectEvent hook.

Hooks are special functions that allow functional components to use React features like state, lifecycle, context, refs, and memoization.

  • useState: Manage state
  • useEffect: Handle side effects
  • useRef: Store mutable values
  • useMemo: Memoize expensive calculation
  • useCallback: Memoize functions
  • useContext: Use global context
function Counter() {
  const [count, setCount] = React.useState(0);

  return (
    <button onClick={() => setCount(count + 1)}>
      Count: {count}
    </button>
  );
}

What is useEffectEvent?

useEffectEvent is used when we want to access latest props or state inside an effect without re-running that effect again and again.

import { useEffect, useEffectEvent } from "react";

function Counter({ count }) {
  const logCount = useEffectEvent(() => {
    console.log("Current count:", count);
  });

  useEffect(() => {
    const id = setInterval(() => {
      logCount();
    }, 1000);

    return () => clearInterval(id);
  }, []);

  return <p>{count}</p>;
}
Interview Answer: Hooks allow functional components to use React features. useEffectEvent helps access latest state or props inside effects without unnecessary effect re-runs.

4. How does caching work in React applications?

Caching means storing data temporarily so the app does not need to fetch or calculate the same thing again and again.

Types of Caching

  • Browser Cache: Stores images, CSS, JS files
  • API Cache: Stores API response
  • React Query Cache: Stores server data in memory
  • Memoization: Stores calculated values
  • Next.js Cache: Caches server fetch result
import { useQuery } from "@tanstack/react-query";

function Users() {
  const { data, isLoading } = useQuery({
    queryKey: ["users"],
    queryFn: () => fetch("/api/users").then(res => res.json()),
    staleTime: 1000 * 60 * 5,
  });

  if (isLoading) return <p>Loading...</p>;

  return data.map(user => (
    <p key={user.id}>{user.name}</p>
  ));
}
const total = useMemo(() => {
  return calculateTotal(items);
}, [items]);
Interview Answer: Caching stores data, assets, or calculated results to avoid repeated work. It improves speed, reduces API calls, and gives better user experience.

5. How do you implement lazy loading in React?

Lazy loading means loading component, route, image, or library only when it is needed. It reduces initial bundle size.

import React, { Suspense, lazy } from "react";

const Dashboard = lazy(() => import("./Dashboard"));

function App() {
  return (
    <Suspense fallback={<p>Loading dashboard...</p>}>
      <Dashboard />
    </Suspense>
  );
}

Lazy Loading Image

<img src="/banner.jpg" alt="Banner" loading="lazy" />

Next.js Dynamic Import

import dynamic from "next/dynamic";

const Chart = dynamic(() => import("./Chart"), {
  loading: () => <p>Loading chart...</p>,
  ssr: false,
});
Interview Answer: Lazy loading loads components or assets only when needed. In React, we use React.lazy, Suspense, dynamic import, and image lazy loading.

6. What’s new in React 19?

React 19 focuses on better async handling, improved forms, actions, optimistic UI, and easier server/client integration.

Important React 19 Features

  • Actions: Easier async form submission
  • useActionState: Manage form state and pending state
  • useOptimistic: Show instant UI before server response
  • use API: Read promises and context
  • Ref as Prop: Easier ref passing
  • Metadata Support: Support for title and meta tags
import { useActionState } from "react";

function Form() {
  async function submit(prevState, formData) {
    const name = formData.get("name");

    if (!name) {
      return { error: "Name is required" };
    }

    return { success: "Saved successfully" };
  }

  const [state, formAction, isPending] = useActionState(submit, {});

  return (
    <form action={formAction}>
      <input name="name" />

      <button disabled={isPending}>
        {isPending ? "Saving..." : "Save"}
      </button>

      {state.error && <p>{state.error}</p>}
      {state.success && <p>{state.success}</p>}
    </form>
  );
}
Interview Answer: React 19 introduces better form actions, useActionState, useOptimistic, use API, improved ref handling, and better async UI management.

7. Build Increment / Decrement Component with Validation

This component allows user to enter a number, increment it, decrement it, and show error message for empty or non-numeric input.

import React, { useState } from "react";

export default function CounterWithValidation() {
  const [value, setValue] = useState("0");
  const [error, setError] = useState("");

  const validateNumber = input => {
    if (input.trim() === "") {
      return "Value is required";
    }

    if (isNaN(Number(input))) {
      return "Please enter a valid number";
    }

    return "";
  };

  const handleChange = e => {
    const inputValue = e.target.value;
    setValue(inputValue);

    const errorMessage = validateNumber(inputValue);
    setError(errorMessage);
  };

  const handleIncrement = () => {
    const errorMessage = validateNumber(value);

    if (errorMessage) {
      setError(errorMessage);
      return;
    }

    setValue(String(Number(value) + 1));
    setError("");
  };

  const handleDecrement = () => {
    const errorMessage = validateNumber(value);

    if (errorMessage) {
      setError(errorMessage);
      return;
    }

    setValue(String(Number(value) - 1));
    setError("");
  };

  return (
    <div className="max-w-sm rounded-2xl border border-gray-200 bg-white p-6 shadow-sm">
      <h2 className="mb-4 text-xl font-bold">Counter</h2>

      <input
        type="text"
        value={value}
        onChange={handleChange}
        placeholder="Enter number"
        className={`w-full rounded-lg border px-4 py-3 outline-none ${
          error ? "border-red-500" : "border-gray-300"
        }`}
      />

      {error && (
        <p className="mt-2 text-sm text-red-600">
          {error}
        </p>
      )}

      <div className="mt-5 flex gap-3">
        <button
          onClick={handleDecrement}
          className="rounded-lg bg-gray-900 px-4 py-2 text-white"
        >
          Decrement
        </button>

        <button
          onClick={handleIncrement}
          className="rounded-lg bg-indigo-600 px-4 py-2 text-white"
        >
          Increment
        </button>
      </div>

      <p className="mt-4 text-gray-700">
        Current Value: {error ? "Invalid input" : value}
      </p>
    </div>
  );
}

Explanation

  • value: stores current input value
  • error: stores validation message
  • validateNumber: checks empty and non-numeric input
  • handleIncrement: increases valid number by 1
  • handleDecrement: decreases valid number by 1
Interview Answer: This component uses useState for input and error state. It validates input before incrementing or decrementing the number.

Final Summary

Topic Simple Meaning
Virtual DOM JavaScript copy of real DOM
Reconciliation Comparing old and new Virtual DOM
SSR HTML generated on server
CSR UI generated in browser
Hooks Functions to use React features
Caching Store data to avoid repeated work
Lazy Loading Load things only when needed
React 19 Better forms, async UI, actions

More In React js

Read more articles from the same category or open the full category archive directly.

Debounced Search Input

React js

How to Build a Debounced Search Input in React.js

“A fast UI is not about making more API calls — it’s about making smarter API calls.”

React js

React js

React 19 Features Explained with React 18 vs React 19 Comparison

“React 19 is not just a version update — it changes how developers handle forms, async UI, optimistic updates, and rendering performance in modern React applications.”

Top AI cource

Career

AI Courses for Software Developers in 2026: Best Course, Salary & Career Path

In 2026, the biggest opportunity is in <strong>Generative AI and applied AI development</strong>. Companies are not just hiring data scientists — they are actively looking for developers who can build AI-powered features like chatbots, recommendation systems, automation tools, and intelligent dashboards.

React js
Debounced Search Input

How to Build a Debounced Search Input in React.js

React js
React js

React 19 Features Explained with React 18 vs React 19 Comparison

Career
Top AI cource

AI Courses for Software Developers in 2026: Best Course, Salary & Career Path

View All React js Articles→

On This Page

Introduction

Recent Posts

Debounced Search Input

How to Build a Debounced Search Input in React.js

7 May 2026

React js

React 19 Features Explained with React 18 vs React 19 Comparison

7 May 2026

Top AI cource

AI Courses for Software Developers in 2026: Best Course, Salary & Career Path

30 March 2026

Bharat Ratna Award

Bharat Ratna Award Winners List 1954 to 2024: History, Facts and Full List

26 March 2026

Awards and Honours

Nobel Prize 2025 Winners, History, Categories, Indian Winners & Important Facts (Hindi + English)

26 March 2026

Javascript

JavaScript ES6+ Interview Questions & Concepts (Destructuring, Spread, Rest)

21 March 2026

React js

JavaScript Basics Explained: Variables, Data Types & Functions with Examples

21 March 2026

Javascript

JavaScript Arrays Explained with Examples Part 2 (Complete Beginner Guide)

20 March 2026

Javascript

JavaScript Arrays Explained with Examples (Complete Beginner Guide)

20 March 2026

Javascript

Callback vs Promises in JavaScript

20 March 2026

Exambodh

Exambodh helps students prepare for aptitude, reasoning, GK, and verbal exams with topic-wise practice questions, simple explanations, and structured learning.

Quick Links

HomePlay QuizArticlesAbout UsContactPrivacy PolicyDisclaimerCopyright PolicyTerms & Conditions

Study Hubs

Latest ArticlesGeneral KnowledgeQuantitative AptitudeLogical ReasoningComputer AwarenessCurrent Affairs

Popular Categories

General KnowledgeIndian HistoryIndian PolityQuantitative AptitudeLogical ReasoningInterview Practice
Explore:HomePlay QuizArticlesContact

Copyright 2026 Exambodh - aptitude, reasoning & verbal practice.