import React from 'react'; export declare type AsyncCompleteState = { status: 'complete'; result: T; }; export declare type AsyncPendingState = { status: 'pending'; }; export declare type AsyncErrorState = { status: 'error'; error: Error; }; export declare type AsyncState = AsyncPendingState | AsyncCompleteState | AsyncErrorState; /** * Takes an async function and returns a [AsyncState, callback] pair. * Whenever the callback is invoked, a new AsyncState is returned. * If the returned callback is called again before the previous callback has settled, the resolution of the previous one will be ignored, thus preventing race conditions. * @param fn an async function that returns a value * @param dependencies list of dependencies that will return a new [value, callback] pair */ export declare function useAsync(fn: (arg: U) => Promise, dependencies: React.DependencyList): [null | AsyncState, (arg: U) => void]; //# sourceMappingURL=useAsync.d.ts.map