DEV Community

Arul .A
Arul .A

Posted on

Why react is called single page application?

  • React is called a Single Page Application because it loads a single HTML page and dynamically updates the UI using client-side rendering and virtual DOM without reloading the entire page.

Why React is SPA (core reason)

  1. React uses Client-Side Rendering (CSR) Browser loads: index.html JavaScript bundle After that β†’ React controls everything

πŸ‘‰ No need to request a new HTML page from server every time

  1. Virtual DOM (the real engine)

React doesn’t touch the real DOM directly every time.

Instead:

Creates a Virtual DOM
Compares old vs new (diffing)
Updates only the changed parts

πŸ‘‰ This is why it feels fast and no reload happens

  1. Routing without reload (important)

Libraries like:

react-router-dom

They change the URL, but:

Do NOT reload the page
Just swap components

Example:

<Route path="/about" element={<About />} />
Enter fullscreen mode Exit fullscreen mode

πŸ‘‰ Clicking /about does NOT fetch a new page
πŸ‘‰ It just renders inside the same page

Top comments (0)