23
loading...
This website collects cookies to deliver better user experience
It does not allow components to wait for data. That means before rendering HTML to the client, you must have your data ready for components on the server.
You need to load the JavaScript for all components on the client before hydrating any of them to make them interactive.
Also, you need to wait for all the components to be hydrated before interacting with them.
The problem can be overcome using two new features of suspense, i.e. Streaming HTML and Selective hydration.
Streaming HTML on the server
With the streaming HTML, React will send the static pieces of UI components using suspense, which will decide which part of the component will take longer to load and what can be directly rendered, so the user does not need to wait to see the initial UI render.
Selective Hydration on the client
With selective hydration, components that are wrapped under suspense will not block hydration. Once the JS and content are loaded for each component it will start hydrating without blocking another component.