Generic async hook — wraps any async function with loading/error/data state. Auto-executes on mount and when deps change.
If the function returns a FetchResponse (from FetchEngine methods), the .data property is automatically unwrapped.
.data
const { data, loading, error } = useAsync( () => myApi.getUsers(page), [page], );
Async function to execute
React dependency list — re-executes when these change
Optional
skip, pollInterval, invalidateOn
Optional ObserverEngine for invalidateOn support
Generic async hook — wraps any async function with loading/error/data state. Auto-executes on mount and when deps change.
If the function returns a FetchResponse (from FetchEngine methods), the
.dataproperty is automatically unwrapped.