Skip to main content

useAsyncValue

Returns the resolved promise value from the closest <Await> component.

Return Value

unknown
The resolved value from the nearest <Await> component’s promise. The type will match whatever your promise resolves to.

Type Declaration

Usage Examples

Basic Usage with Await

Displaying User Data

Multiple Deferred Values

Type Safety

Using TypeScript

With Generic Type Inference

Common Patterns

Nested Await Components

Error Handling

For error handling with deferred data, use useAsyncError or provide an errorElement prop to the <Await> component:

Notes

  • This hook must be used within a component rendered by an <Await> component
  • The hook returns the resolved value, not the promise itself
  • Available in Framework and Data modes only
  • The returned value is unknown by default - use type assertions for type safety
  • This hook does not handle errors - use useAsyncError or errorElement for error handling