Function useAccountResource
-
useAccountResource<T>(
load: (signal: AbortSignal) => Promise<T>,
dependencies?: unknown[],
): {
data: T | null;
error: string | null;
loading: boolean;
reload: () => void;
}Type Parameters
- T
Parameters
- load: (signal: AbortSignal) => Promise<T>
Cancellable async resource loader.
- dependencies: unknown[] = []
Host dependency values that reload the resource. Defaults to [].
Returns { data: T | null; error: string | null; loading: boolean; reload: () => void }
-
data: T | null
Loaded authoritative data, or null while unavailable.
-
error: string | null
Customer-visible error, or null.
-
loading: boolean
Whether the read is pending.
-
reload: () => void
Reload the resource from its authoritative API.
Load a cancellable account resource when its host dependencies change.