To get started with streaming data, check out the Streaming Guide.
The <Await>
component is responsible for resolving deferred loader promises accessed from useLoaderData
.
Props
resolve
The resolve prop takes a promise from useLoaderData
to resolve when the data has streamed in.
When the promise is not resolved, a parent suspense boundary’s fallback will be rendered.
When the promise is resolved, the children
will be rendered.
children
The children
can be a render callback or a React element.
If the children
props is a React element, the resolved value will be accessible through useAsyncValue
in the subtree.
errorElement
The errorElement
prop can be used to render an error boundary when the promise rejects.
<Await errorElement={<div>Oops!</div>} />
The error can be accessed in the subtree with useAsyncError
Tip
Using Await
with multiple promises