dev
Branches
main (6.4.4)dev
Versions
6.4.4v4/5.xv3.x
useAsyncValue

useAsyncValue

Returns the resolved data from the nearest <Await> ancestor component.

function ProductVariants() {
  const variants = useAsyncValue();
  return <div>{/* ... */}</div>;
}

// Await creates the context for the value
<Await resolve={somePromiseForProductVariants}>
  <ProductVariants />
</Await>;

See the Deferred Data Guide and <Await> docs for more information.

Docs and examples CC 4.0
Edit