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
resolveDeferred<T>The deferred value, typically read out of a route's loader data.
childrenFunc<T, VNode>Renders the resolved value.
errorElementVNodeRendered in place of
childrenwhen the deferred value's task fails, or when rendering the value throws;Hooks.UseAsyncErrorreads the exception beneath it. Without one, the exception propagates to the nearest error boundary.keystringKey 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
resolveDeferred<T>The deferred value, typically read out of a route's loader data.
childrenVNodeRendered once the value resolves.
errorElementVNodeRendered in place of
childrenwhen the deferred value's task fails, or when renderingchildrenthrows.keystringKey used to disambiguate siblings at the same position.
Returns
- ComponentNode
A ComponentNode rendering
children.
Type Parameters
T