Rezi
Preparing search index...
core/src
useAsync
Function useAsync
useAsync
<
T
>
(
ctx
:
AsyncHookContext
,
task
:
()
=>
Promise
<
T
>
,
deps
:
readonly
unknown
[]
,
)
:
UseAsyncState
<
T
>
Run an async operation when dependencies change.
Sets
loading
to
true
while the operation is in-flight
Stores resolved value in
data
Stores thrown/rejected value in
error
Ignores stale completions from older dependency runs
Type Parameters
T
Parameters
ctx
:
AsyncHookContext
task
:
()
=>
Promise
<
T
>
deps
:
readonly
unknown
[]
Returns
UseAsyncState
<
T
>
Settings
Member Visibility
Protected
Inherited
Theme
OS
Light
Dark
Rezi
Loading...
Run an async operation when dependencies change.
loadingtotruewhile the operation is in-flightdataerror