Table of Contents

Method Await

Namespace
Velvet
Assembly
Velvet.Docs.dll

Await<T>(Deferred<T>, Func<T, VNode?>, VNode?, string?)

Renders the value a Deferred<T> resolves to: React Router's <Await>. While the value is still on its way it suspends to the nearest Suspense(VNode?, VNode?[], string?), which shows its fallback. Hooks.UseAsyncValue reads the value beneath it.

public static ComponentNode Await<T>(Deferred<T> resolve, Func<T, VNode?> children, VNode? errorElement = null, string? key = null)

Parameters

resolve Deferred<T>

The deferred value, typically read out of a route's loader data.

children Func<T, VNode>

Renders the resolved value.

errorElement VNode

Rendered in place of children when the deferred value's task fails, or when rendering the value throws; Hooks.UseAsyncError reads the exception beneath it. Without one, the exception propagates to the nearest error boundary.

key string

Key used to disambiguate siblings at the same position.

Returns

ComponentNode

A ComponentNode rendering the value.

Type Parameters

T

Await<T>(Deferred<T>, VNode, VNode?, string?)

Renders children once a Deferred<T> resolves: React Router's <Await> with element children, which read the value through Hooks.UseAsyncValue. Suspends and fails as Await<T>(Deferred<T>, Func<T, VNode?>, VNode?, string?) does.

public static ComponentNode Await<T>(Deferred<T> resolve, VNode children, VNode? errorElement = null, string? key = null)

Parameters

resolve Deferred<T>

The deferred value, typically read out of a route's loader data.

children VNode

Rendered once the value resolves.

errorElement VNode

Rendered in place of children when the deferred value's task fails, or when rendering children throws.

key string

Key used to disambiguate siblings at the same position.

Returns

ComponentNode

A ComponentNode rendering children.

Type Parameters

T