Hydration and Hydration Mismatches
Understand how React attaches interactivity to server-rendered HTML, and why mismatches between server and client output cause errors.
Hydration is the process by which React takes server-rendered, already-present HTML and 'attaches' its interactive JavaScript behavior to it, rather than tearing it down and re-rendering from scratch on the client. React walks the existing DOM structure alongside the component tree it would have rendered, matching them up and attaching event listeners and internal fiber state to the already-present nodes, ideally without needing to modify the DOM at all if everything lines up correctly.
Hydration is like an usher matching ticket holders to seats that are supposedly already set up exactly as printed on the tickets — if a seat doesn't match what the ticket says (a mismatch), the usher can't just quietly seat them there; the whole row has to be re-set-up on the spot, defeating the point of having pre-arranged seating at all.