useAsyncValue

useAsyncValue

摘要

参考文档 ↗

从最近的 <Await> 返回已解析的 promise 值。

function SomeDescendant() {
  const value = useAsyncValue();
  // ...
}

// somewhere in your app
<Await resolve={somePromise}>
  <SomeDescendant />
</Await>;

签名

function useAsyncValue(): unknown

返回

来自最近的 Await 组件的已解析值

文档和示例 CC 4.0
编辑