Hydration
Hydration is the process of reconnecting HTML that was pre-rendered on the server with the JavaScript application in the browser so that event handlers and state updates become active. It turns markup that is already visible but still static into an interactive UI the user can actually click, type into, and navigate.
โถArchitecture Diagram
๐ ProcessDashed line animations indicate the flow direction of data or requests
When an SSR page first loads, the screen may appear immediately but buttons can remain unresponsive for a short time. The user is already looking at HTML, but the JavaScript in the browser still does not know which component produced that markup or which events should be attached to which elements. Rendering HTML on the server alone does not create interaction. Showing the screen quickly and turning that screen into a live application are separate steps, and Hydration is the process that bridges them.
Early server rendering was strong at delivering finished HTML, but for the browser-side framework to take over interaction it needed a way to recognize and adopt that UI instead of discarding it. Once frontend frameworks began sharing the same component code between server and browser, it became possible to ask: 'Can the browser reuse the server-rendered DOM instead of rebuilding everything from scratch?' Hydration is the answer to that question. It lets the client attach state and event handlers onto the DOM that the server already produced, acting as the bridge between SSR's fast initial display and SPA-style interactivity.
Hydration starts with the browser painting the HTML sent from the server. At that moment the user can already see text and layout. After that, the JavaScript bundle loads and the framework computes the same component tree again inside the browser. During this step, the framework matches the existing DOM nodes to the client-side output it expects. If they line up, it reuses the current DOM and only attaches the necessary event handlers and state connections. That is why the framework can avoid throwing away and repainting the whole screen. The trouble begins when the server and client outputs differ. Values such as the current time, random numbers, or browser-only APIs can make the client generate markup that no longer matches what the server sent. That causes hydration mismatch warnings and may force the framework to discard and rebuild part of the DOM.
Hydration and SSR travel together, but they are not the same concept. SSR is the rendering strategy that produces HTML on the server. Hydration is the follow-up step that connects that HTML to the browser's event and state system. One generates markup; the other activates it. It also differs from SPA rendering. In a pure SPA, the browser creates the screen from the start. Hydration only exists when there is server-rendered HTML to adopt. So Hydration belongs to hybrid rendering flows, not to client-only rendering.
Hydration is a core stage in almost every modern frontend framework that wants the first screen to appear quickly from the server. It matters most on pages where the visible content is valuable immediately: product detail pages, documentation, article pages, and marketing screens. In practice, reducing mismatches is the main challenge. Reading `window` during render, embedding the current time directly in visible markup, or branching differently on server and client will all create hydration warnings. Those values need to be delayed, isolated, or rendered only on the client. There is also no rule that every component must hydrate at once. Activating the most important interactive areas first, or deferring less important islands, can improve the perceived responsiveness of the page. Hydration is therefore partly a performance design problem about how long the gap between 'visible' and 'alive' should be allowed to remain.