CodePark/ questions / Hydration cost & islands
START PRACTICINGPRACTICE
Frontend question · Browser & web performance › Hydration cost & islands

A React 18 page streams in with several <Suspense> sections. Before the sidebar has hydrated, the user clicks a button in it. What does React do?

It hydrates the sidebar first, ahead of the other sections, then handles the click

This is selective hydration. React records the click, raises the priority of the boundary that was clicked, and hydrates it first. For discrete events like clicks, it then replays the event, so the click isn't lost.

"It ignores the click" is the tempting wrong answer, and it is what happens with plain HTML before any script runs. With
<Suspense> boundaries, React can hydrate sections in any order, guided by what the user touches.