Function useLoadResourcesState
- useLoadResourcesState<T>(onLoad): [resources: T[], isLoading: boolean, loadError: Error | null, handleRefresh: (() => void), setResult: React.Dispatch<React.SetStateAction<T[]>>]
-
Parameters
-
onLoad: ((abortSignal) => Promise<T[]>)
-
- (abortSignal): Promise<T[]>
-
Returns Promise<T[]>
Returns [resources: T[], isLoading: boolean, loadError: Error | null, handleRefresh: (() => void), setResult: React.Dispatch<React.SetStateAction<T[]>>]
This function is a react hook for managing the state involved with loading resources.
Example