Skip to content
Reactjs Javascript

Why Javascript Hyderation is Evil

Raheel Shan

Raheel Shan

November 21st, 2026 · 13 min read

Why Javascript Hyderation is Evil

Have you ever opened a website, clicked a button, and nothing happened?

You click again. Still nothing. Then after a second or two, the page suddenly starts working — and both of your clicks run together.

This is not a bug. This is hydration. And today popular frameworks like Next.js, Nuxt and SvelteKit use it by default.

In my Web Transition series, we saw how rendering moved from the server to the browser in The SPA Takeover, and how it is now coming back in The Return to Simplicity. Hydration sits right in the middle. It tries to give us both — server HTML and a client-side framework. But in the end, we pay for both.

Let me explain why I think hydration is evil.

What Is Hydration?

Let's keep it simple. Here's what happens on a page that uses hydration:

  1. The server renders the page into HTML.
  2. The browser shows that HTML. It looks ready, but nothing works yet.
  3. The browser downloads JavaScript and runs the same components again. It builds the whole page again in memory, matches it with the HTML, and then attaches the click events.

Only after step 3 does the page actually work.

Now think about it. The server already did the work. The browser does the same work again — just to know which button should run which function.

Wait, Don't SPAs Start With an Empty Page?

Yes, they do. And that's a fair question.

There are two ways JavaScript frameworks build a page. Only one of them uses hydration.

1. Client-Side Rendering (Empty Page)

The server sends an almost empty HTML file with one <div id="app">. Then JavaScript downloads and builds the whole page from nothing.

There is no hydration here. There is nothing to hydrate.

This is plain React with Vite, a Vue SPA, Angular — and Inertia by default. With Inertia, Laravel sends the page data as JSON in a data-page attribute, and Vue or React builds the page in the browser.

But we already know the problem. Google sees an empty page. The user sees a blank screen or a spinner. I covered this in The SPA Takeover.

2. Server-Side Rendering + Hydration

To fix SEO and the blank screen, frameworks started rendering the HTML on the server first. Then the browser takes over that HTML. That take-over step is hydration.

Tools that work this way:

  • Next.js (React)
  • Nuxt (Vue)
  • Remix / React Router (React)
  • SvelteKit (Svelte)
  • Gatsby (React)
  • Angular SSR
  • Inertia with SSR turned on

Inertia is a good example for us Laravel developers. When you turn on SSR, Inertia renders your pages in a Node.js process. Then in app.js you switch to createSSRApp (Vue) or hydrateRoot (React), so the browser can take over the server HTML.

So now you run Laravel and a Node server — just to render HTML that Blade can render on its own.

React's own docs make this clear. hydrateRoot is only for HTML that was already rendered on the server. For an empty page, you use createRoot instead.

What About Livewire?

Livewire also uses the word "hydration", but it means something different.

Livewire renders the HTML on the server, and the browser doesn't build the page again. So the problems in this article don't apply to it in the same way.

But it has its own version. Livewire stores the component state as JSON in a wire:snapshot attribute. On every request, that JSON goes back to the server, and Laravel rebuilds the PHP component from it. Livewire calls that rebuild "hydration". I explained this in What Is Livewire? How Laravel Livewire Works Under the Hood.

So in this article, when I say hydration, I mean case 2 — the server renders HTML, and the browser runs the same components again to take it over.

Problem 1: We Send the Page Twice

With hydration, the browser gets three things:

  • The HTML, so the user sees something quickly.
  • The data as JSON, so JavaScript can build the same page again.
  • The JavaScript code for every component on the page.

So the same product list comes in the HTML. Then it comes again in JSON. And the code to render it comes in the JavaScript file.

On a good laptop you will not notice. But on a cheap Android phone with slow internet, you will. Running JavaScript is the heaviest work for a phone. And hydration does it on every page — even when the user only wants to read.

Problem 2: The Page Looks Ready But It Is Not

Before hydration finishes, the page is just a picture. Buttons are there. Links are there. But clicks don't work yet.

So users click. Some clicks are lost. Some clicks run later. This is how we get double orders and double form submissions.

A normal server-rendered page doesn't have this problem. A <form> with an action works the moment it shows. A link is just a link. The browser already knows what to do. No framework needs to wake up first.

Problem 3: Hydration Mismatch Errors

Hydration only works if the browser creates exactly the same HTML as the server. Not almost the same. Exactly the same.

If not, you get a hydration mismatch error. And guess what? It happens a lot:

  • A date shown in server time, then in user time.
  • A random number or random ID.
  • Code that reads window, localStorage or screen size.
  • A browser extension that adds something to the page.

Then we start writing extra code just to fix this — useEffect tricks, suppressHydrationWarning, client-only wrappers. This code has nothing to do with our feature. We write it only because of hydration.

In Blade, {{ now()->format('d M Y') }} runs once on the server. That's it. Nothing to match. Nothing to break.

Problem 4: Same Code Runs in Two Places

With hydration, each component runs in two places — on the server and in the browser. This means:

  • Every component must work in both places.
  • Data must be converted to JSON to move between them.
  • You must have a build system.
  • When something breaks, first you have to find out where it ran — server, browser or both.

For Laravel developers it's even worse. We already have a good server. But these setups push us to run a Node server for HTML and use Laravel only as a JSON API.

I talked about this in I'm SO Looking Forward to Not Needing a Build System Again. Hydration is one of the big reasons we can't get rid of the build step.

Even the Frameworks Agree

Here's the funny part. The JavaScript world itself is now working hard to hydrate less:

  • Partial hydration — hydrate only some parts of the page.
  • Islands (Astro) — most of the page is plain HTML, with small interactive parts.
  • Resumability (Qwik) — skip hydration completely.
  • Server Components (React) — keep most components on the server and don't send their JavaScript.

All of these point in the same direction. Render on the server. Send HTML. Send less JavaScript.

But that's not new. That's how the web worked before SPAs. We are back where we started — just with a bigger node_modules folder.

What I Do Instead

My answer is simple. Don't hydrate at all.

Let the server render the HTML, and that HTML is the app. JavaScript only adds small behaviour on top of it.

In Laravel I use three things:

  1. Blade partials — render the UI on the server.
  2. HTMX — loads a fresh partial and replaces it on the page when something changes.
  3. jsRibbon — my small library for reactivity. It works on the existing HTML. No virtual DOM. No build step.

Let's see a simple cart example.

Blade View

The container has the HTMX attributes. Inside it, we include the partial:

{{-- resources/views/cart/index.blade.php --}}
<tbody>
    @foreach ($cart->items as $item)
        <tr id="cart-row-{{ $item->id }}"
            hx-get="/partials/cart/row/{{ $item->id }}"
            hx-trigger="cart-updated from:body"
            hx-swap="innerHTML">
            @include('cart.partials.row', ['item' => $item])
        </tr>
    @endforeach
</tbody>

Blade Partial

The partial has jsRibbon bindings for the quantity buttons:

{{-- resources/views/cart/partials/row.blade.php --}}
<td>{{ $item->name }}</td>
<td>
    <button data-bind="click:decrement">−</button>
    <span data-bind="text:qty">{{ $item->qty }}</span>
    <button data-bind="click:increment">+</button>
</td>
<td>{{ number_format($item->total) }}</td>

Now see what we don't have:

  • No JSON. The quantity is in the HTML only once.
  • No second render. The browser doesn't build the page again.
  • No dead buttons. The row works the moment it shows.
  • No mismatch errors. Only Blade renders the HTML.

When the data changes, Laravel sends back a fresh partial and HTMX swaps it in. Just like that.

If you want the full setup, read Laravel with HTMX: Use Blade Partials as Your API. For how each partial gets its data, read Blade Partial API Pattern: Fetching Data. New to HTMX? Start with the Laravel HTMX Tutorial. And if you want to know why I skip JSON APIs, read Skip JSON, Use Blade.

When Is Hydration Fine?

To be fair, hydration is not wrong everywhere. It makes sense for:

  • Apps where users stay for hours, like Figma, Google Docs or trading dashboards.
  • Apps with heavy browser work, like drag-and-drop editors or offline apps.
  • Teams already fully on React, sharing components between web and mobile.

The problem is not hydration itself. The problem is that it became the default for everything — blogs, landing pages, admin panels, product listings, simple forms.

These pages are mostly content with a few buttons. Why should they carry all that JavaScript?

For most Laravel apps, hydration gives us nothing.

Final Thoughts

Hydration makes the browser do the server's work again — just to attach some click events.

The frameworks are now trying hard to hydrate less. We can skip it completely. Render with Blade. Update with HTMX. Add small reactivity with jsRibbon. One renderer. HTML that works the moment it loads.

If you want to see how far plain Laravel can go, read Livewire without Livewire, Inertia without Inertia, GraphQL without GraphQL next. Or compare both server-side approaches in HTMX vs Livewire.

Summary

  • Hydration sends the page twice — as HTML, as JSON and as JavaScript.
  • The page looks ready but doesn't work for a while.
  • It creates mismatch errors that we have to fix with extra code.
  • It needs two runtimes and a build system.
  • Blade + HTMX + jsRibbon gives us interactive pages without any hydration.

Found this useful?

Support the work that goes into these posts.

Support