What is hydration in Angular?
Model answer
Hydration is the step where the browser reuses the HTML that the server rendered and attaches Angular to it, instead of throwing it away and rendering again. It avoids flicker and repeated work and improves load metrics.
It works only if the server and browser produce the same DOM. Problems usually come from direct DOM changes or invalid HTML. Event replay can capture user clicks that happen before hydration finishes.
Learn this topic
Angular Tutorial: Beginner to Advanced .
Sign in to add your own answer.
More questions
- Why is track important in @for (or trackBy in *ngFor)?
- What are the main ways to improve Angular app performance?
- Why is calling a method in a template expression a performance problem?
- What is NgOptimizedImage and what does it give you?
- What is server-side rendering (SSR), and why would you use it?
- What is the difference between SSR, SSG (prerendering) and CSR, and how do you choose?