DEV Community

koushik Hazra
koushik Hazra

Posted on

SSR vs CSR — What Actually Happens When Your Page Loads?

SSR vs CSR — What Actually Happens When Your Page Loads?

If you've worked with React or Next.js for a while, you've probably heard these two terms a hundred times:

CSR — Client-Side Rendering
SSR — Server-Side Rendering

At first, they sound simple.

"CSR renders on the client, SSR renders on the server."

Technically correct.

But that explanation doesn't really answer the questions that matter.

What actually happens when a user opens a page?

Why can one website show content almost immediately while another appears blank for a moment?

Why does SSR usually help with SEO?

And most importantly — when should you actually use SSR or CSR?

Let's understand it from the browser's point of view, rather than memorizing definitions.


First, Let's Understand the Problem

Imagine you're visiting an e-commerce website.

You click:

example.com/products
Enter fullscreen mode Exit fullscreen mode

Your browser needs to somehow turn that URL into something you can see:

Products
────────────────────
iPhone
MacBook
AirPods
...
Enter fullscreen mode Exit fullscreen mode

The interesting question is:

Who is responsible for creating this HTML?

There are two major possibilities.

CSR → Browser creates the page

SSR → Server creates the page
Enter fullscreen mode Exit fullscreen mode

That single difference changes quite a lot.


🟦 CSR — Client-Side Rendering

Let's start with something most React developers are familiar with.

In a typical React application, the browser initially receives something similar to:

<div id="root"></div>
Enter fullscreen mode Exit fullscreen mode

There's not much actual content inside it.

The browser then downloads the JavaScript bundle.

React starts running.

The application makes API requests.

The data arrives.

React renders the UI.

Finally, the user sees the page.

The flow looks like this:

Browser
   │
   │ Request page
   ↓
Server
   │
   │ HTML + JavaScript
   ↓
Browser
   │
   ├── Download JS
   ├── Execute React
   ├── Fetch API data
   └── Render UI
   ↓
User sees page
Enter fullscreen mode Exit fullscreen mode

📍 IMAGE 1 — Add a diagram here

Create a clean diagram showing:

User
 ↓
Browser
 ↓
Request HTML
 ↓
Server
 ↓
Empty HTML + JS
 ↓
Browser executes JS
 ↓
API Request
 ↓
Data
 ↓
React renders UI
Enter fullscreen mode Exit fullscreen mode

A flow diagram works much better here than a random stock image.


Why Does CSR Feel Slow Sometimes?

Imagine the user has a slow internet connection.

The browser receives:

<div id="root"></div>
Enter fullscreen mode Exit fullscreen mode

Then it waits for JavaScript.

Then React loads.

Then the API request happens.

Then the data arrives.

Only after all of that does the user get the actual content.

You might see something like:

Loading...
Loading...
Loading...

Products finally appear.
Enter fullscreen mode Exit fullscreen mode

This doesn't mean CSR is bad.

It simply means that the browser has more work to do before it can display meaningful content.

And for applications like dashboards, admin panels, or highly interactive applications, that's often perfectly acceptable.


🟩 SSR — Server-Side Rendering

Now let's change the approach.

Instead of asking the browser to build the page, we ask the server to build it first.

The flow becomes:

Browser
   │
   │ Request /products
   ↓
Server
   │
   ├── Fetch product data
   ├── Generate HTML
   ↓
Browser
   │
   │ Receives complete HTML
   ↓
User sees content
Enter fullscreen mode Exit fullscreen mode

The server might send something like:

<h1>Products</h1>

<div>
    <h2>iPhone</h2>
    <p>$999</p>
</div>

<div>
    <h2>MacBook</h2>
    <p>$1299</p>
</div>
Enter fullscreen mode Exit fullscreen mode

The browser doesn't have to wait for React to create the initial page.

It already has meaningful HTML.


The Interesting Part: Hydration

And this is where things become more interesting.

Getting HTML from the server doesn't mean React is finished.

The browser still needs to make that HTML interactive.

For example:

Server
   ↓
HTML
   ↓
Browser displays HTML
   ↓
JavaScript loads
   ↓
React hydrates
   ↓
Page becomes interactive
Enter fullscreen mode Exit fullscreen mode

Suppose you have a button:

<button onClick={handleClick}>
    Add to Cart
</button>
Enter fullscreen mode Exit fullscreen mode

The server can send the button's HTML.

But the server can't handle the user's click inside their browser.

React needs to connect the JavaScript behavior to that existing HTML.

That's hydration.


SSR vs CSR — The Real Difference

Here's the simplest way I remember it:

CSR asks the browser to build the page.

SSR asks the server to build the initial page.

Everything else — SEO, performance, loading experience, hydration — follows from this fundamental difference.


Let's Compare Them

CSR SSR
Initial HTML Mostly empty shell Contains page content
Rendering happens Browser Server
Initial load Can be slower Usually faster for content
JavaScript dependency High Still required for interactivity
SEO More challenging Generally better
Server workload Lower Higher
Interactivity Excellent Excellent after hydration
Best for Dashboards, apps Content-heavy pages

🚀 What About SEO?

This is one of the biggest reasons SSR became popular.

Search engines need to understand your content.

Consider a blog page.

With CSR, the initial HTML might look like:

<div id="root"></div>
Enter fullscreen mode Exit fullscreen mode

The actual article content appears only after JavaScript executes.

With SSR, the initial HTML can already contain:

<h1>Understanding Distributed Systems</h1>

<p>
Distributed systems are...
</p>
Enter fullscreen mode Exit fullscreen mode

A crawler can immediately see meaningful content.

This makes SSR a natural fit for:

  • Blogs
  • News websites
  • E-commerce product pages
  • Documentation
  • Marketing websites
  • Public-facing pages

But Wait — Is SSR Always Better?

No.

And this is where many tutorials oversimplify the topic.

If SSR were always better, we wouldn't need CSR.

Imagine a dashboard:

/dashboard
Enter fullscreen mode Exit fullscreen mode

The page contains:

  • Charts
  • Filters
  • Tables
  • Drag-and-drop components
  • Real-time notifications
  • User-specific data

Almost everything depends on the current user's interaction.

Do you really need the server to generate every version of that UI?

Probably not.

A client-rendered dashboard can make perfect sense.

# 🧠 A Real-World Example

Imagine you're building an online learning platform.

You have:

/
├── Home
├── Courses
├── Course Details
├── Dashboard
├── Profile
└── Settings
Enter fullscreen mode Exit fullscreen mode

Would you render everything the same way?

Probably not.

Home

Mostly public content.

→ SSR / SSG can be useful.

Course Details

Public and SEO-friendly.

→ SSR / SSG can be useful.

Dashboard

Highly personalized.

→ CSR can be a great choice.

Settings

Private and interactive.

→ CSR is often reasonable.

The important lesson is:

A modern application doesn't have to choose only one rendering strategy.

You can use different strategies for different pages.


⚡ Where Does Next.js Come In?

This is one of the reasons Next.js is so interesting.

Instead of forcing developers into:

Everything = CSR
Enter fullscreen mode Exit fullscreen mode

or

Everything = SSR
Enter fullscreen mode Exit fullscreen mode

Next.js gives you multiple rendering strategies.

Depending on the architecture and version, you can work with concepts such as:

  • Server-side rendering
  • Static generation
  • Incremental regeneration
  • Client-side rendering
  • React Server Components

So instead of asking:

"SSR or CSR?"

the better question becomes:

"What rendering strategy makes sense for this particular part of my application?"


🔥 The Biggest Misconception

One thing I wish I had understood earlier:

SSR does not mean the entire application runs on the server.

And:

CSR does not mean there is no server.

Both applications still have servers.

Both can have APIs.

Both can use databases.

Both can use JavaScript.

The main difference is where the initial UI rendering happens.

That distinction makes the whole topic much easier to understand.


So, Which One Should You Use?

Here's my practical rule of thumb.

Choose SSR when:

  • The page is public.
  • SEO matters.
  • Initial content should appear quickly.
  • The content is generated from server-side data.
  • You want search engines to easily understand the page.

Choose CSR when:

  • The page is highly interactive.
  • SEO isn't important.
  • The content is heavily personalized.
  • Most of the work happens after user interaction.
  • You're building dashboards or application-like interfaces.

And in many real applications?

Use both.

That's usually the better answer.


Final Thought

SSR vs CSR isn't really a battle.

It's a design decision.

The interesting question isn't:

"Which one is better?"

It's:

"Which one is better for this page, this user, and this application?"

Once you start thinking that way, rendering stops being a collection of confusing acronyms.

It becomes an architectural decision.

And that's the part that actually matters.


📌 Quick Mental Model

If you remember only one thing from this article:

CSR
Browser → JavaScript → Data → UI

SSR
Server → Data → HTML → Browser → Hydration
Enter fullscreen mode Exit fullscreen mode

That's the foundation.

Everything else builds on top of it.

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.