Streaming Data with Promises in load
Return unresolved promises from load to stream data after the initial HTML.
Why Stream
Streaming load lets the page render before slow data resolves, improving perceived performance.
Return Promises
Return data with some properties as unresolved promises.
export async function load() {
return {
fast: getFastData(),
slow: getSlowData() // promise, not awaited
};
}All lessons in this course
- Streaming Data with Promises in load
- Deferred Loading and Suspense-Like UX
- Streaming from Server with +server.js
- Progressive Hydration