useAsyncValue
从最近的 <Await>
父组件返回已解析的数据。
jsx
function ProductVariants() {
const variants = useAsyncValue();
return <div>{/* ... */}</div>;
}
// Await creates the context for the value
<Await resolve={somePromiseForProductVariants}>
<ProductVariants />
</Await>;
function ProductVariants() {
const variants = useAsyncValue();
return <div>{/* ... */}</div>;
}
// Await creates the context for the value
<Await resolve={somePromiseForProductVariants}>
<ProductVariants />
</Await>;