Hydration.
Hydration is the step in which a JavaScript framework such as React makes an already rendered HTML page interactive in the browser: it attaches click handlers, state and logic to the existing HTML. The page is therefore visible immediately but only becomes fully usable after hydration. How much JavaScript has to be hydrated has a strong effect on loading time and responsiveness.
Hydration — Explained in Detail
Modern websites built with React or similar JavaScript frameworks are often generated as HTML on the server or at build time, using server-side rendering or static generation. The browser can display this HTML straight away. For buttons, menus and forms to respond, however, the framework then has to load its JavaScript in the browser, rebuild the component tree and connect it to the existing HTML. This process is called hydration, because a 'dry' HTML page is 'watered' with logic.
Hydration is a compromise. It combines the advantages of server-rendered HTML, fast display and good readability for search engines, with the interactivity of a single page application. The price: the browser has to download, parse and execute the code of every interactive component. On large pages this blocks the main thread. During that time the page looks finished but responds to clicks with a delay, which shows up in the INP (Interaction to Next Paint) metric.
A well-known problem is the hydration mismatch. It occurs when the HTML from the server does not match what React expects in the browser, for example when a date is formatted in a different time zone or a value depends on chance. React then issues a warning and rebuilds parts of the page, which can cause visible jumps and extra work.
Developments in recent years aim to hydrate less. Partial hydration and islands architectures bring only individual interactive areas to life instead of the whole page. React Server Components, as used in the App Router of Next.js, render components exclusively on the server and send no JavaScript for them to the browser at all. Only the parts explicitly marked as client components, such as a form or a menu, are still hydrated.
Why hydration matters for speed and SEO
For search engines, the pre-rendered HTML is what counts, because it already contains texts, links and structured data without JavaScript. Hydration itself hardly matters for indexing, but it does matter for user experience, which Google measures through the Core Web Vitals. A lot of client JavaScript lengthens the time until a page responds reliably and noticeably worsens interaction values on weaker smartphones.
In our web development in Zurich we therefore work with Next.js and Server Components: content stays on the server and only genuinely interactive parts are hydrated. That is one of the reasons we recommend an alternative to WordPress with a lean front end for websites that are meant to rank.
Example: a service page with a calculator
A typical case, described as an example: a service page consists of long text, images, an FAQ and a small cost calculator. In a classic React implementation, the entire page is hydrated, although only the calculator is interactive. On older smartphones the first click responds with a noticeable delay.
With Server Components, text, images and FAQ remain plain HTML. Only the calculator is a client component and is hydrated. The amount of JavaScript drops considerably, the calculator becomes usable faster, and nothing changes in the visible content. We also review existing web apps for this kind of rework.
Related Page
Server-Side RenderingFrequently Asked Questions About Hydration
Not directly. Search engines read the pre-rendered HTML, which exists before hydration. Indirectly, however, too much hydration can worsen user experience and therefore metrics such as INP. The key is to hydrate only what really has to be interactive.
A hydration error occurs when the HTML from the server does not match the result React produces in the browser. Typical causes are dates and times, random values or content only available in the browser. React then shows a warning and re-renders parts of the page.
Server Components are rendered only on the server and send no JavaScript to the browser, so they do not need to be hydrated. Only client components, such as forms or menus, go through hydration. This reduces the amount of code the browser has to execute.
More Terms Starting with "H"
Headless CMS
A headless CMS is a content management system without an integrated frontend ('head'). Content is pr...
HTTPS & SSL
HTTPS (HyperText Transfer Protocol Secure) means that data transmission between browser and server i...
Headless Architecture
Headless Architecture separates the frontend (the visible website) from the backend (database, CMS, ...
Ready for Your Project?
Apply this knowledge to your website — DLM Digital will help you.