mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
16 lines
341 B
TypeScript
16 lines
341 B
TypeScript
export declare type AsyncState<T> = {
|
|
loading: true;
|
|
error?: undefined;
|
|
value?: undefined;
|
|
} | {
|
|
loading: false;
|
|
error: Error;
|
|
value?: undefined;
|
|
} | {
|
|
loading: false;
|
|
error?: undefined;
|
|
value: T;
|
|
};
|
|
declare const useAsync: <T>(fn: () => Promise<T>, args?: any) => AsyncState<T>;
|
|
export default useAsync;
|