Suspense
Renders fallback while asynchronous children resolve, then renders the result or error output.
Table of contents
Category
Value
Import
jsimport { Suspense } from "valyrian.js/suspense";Public signature
tstype SuspenseProps = {
suspenseKey: string | number;
fallback: any | Vnode | ValyrianComponent;
error?: (error: Error) => any | Vnode | ValyrianComponent;
children?: any;
key?: string | number;
};
function Suspense(
{ suspenseKey, fallback, error }: SuspenseProps,
children: Children,
): VnodeProps and children
suspenseKey and fallback are required. error is optional and defaults to rendering error.message. Suspense resolves vnode components, POJO components, function components and plain values through its Children argument.
Identity
suspenseKey identifies the async scope. key remains the structural vnode identity used by reconciliation.
Errors
Throws when rendered outside a component or without suspenseKey.