ADVANCED ANGULAR • LESSON 18 OF 23

SSR, Hydration and Incremental Hydration

What you will learn

Render useful HTML on the server and activate it safely in the browser.

  • Server-side rendering sends HTML before the browser downloads all application JavaScript. Hydration reuses that server DOM and attaches Angular behavior.
  • provideClientHydration enables hydration features. Event replay can capture early user actions and replay them after the related view becomes interactive.
  • Incremental hydration combines hydratable @defer blocks with hydrate triggers, reducing how much of a large page must activate immediately.
  • Server and browser output must agree. Guard browser-only APIs, use stable data, and avoid invalid HTML that the browser restructures before hydration.

How it works

1Server renders HTML
2Browser displays content
3Hydration trigger fires
4Angular activates interaction

Expected result

Product content arrives as server HTML; the review area hydrates when it approaches the viewport.

Common mistakes

Do not read window or localStorage during server rendering. Do not generate random template output independently on server and client. Check the console for hydration mismatches.

Read the official Angular guide →