[]previous and next page

Await

Renders deferred data with a fallback and an error element.

Renders deferred data with a fallback and an error element. Use it for a loader's deferred value, or any promise a component owns.

Import#

ts
import { Await } from "@shadow-js/dusk/client";

Signature#

ts
function Await<T>(props: AwaitProps<T>): unknown

Parameters#

Name Description
props See AwaitProps.

Returns#

The rendered boundary.

Examples#

ts
<Await resolve={comments} fallback={<p>Loading comments</p>} errorElement={() => <p>No comments</p>}>
  {(list) => <ul>{list.map((item) => <li>{item}</li>)}</ul>}
</Await>