import { Dispatch, ReactNode, SetStateAction } from 'react';
export declare type FetchFunc = (input: Input) => Promise;
export declare type FetchState = {
input: Input;
result?: Result;
error?: unknown;
promise?: Promise;
};
export declare const createFetchState: (fn: FetchFunc, input: Input) => FetchState;
declare type FetchMap = Map, FetchState>;
declare type MapState = readonly [
FetchMap,
Dispatch>
];
declare type FetchProviderProps = {
initialInputs?: Iterable, any]>;
children: ReactNode;
};
/**
* FetchProvider component
*
* Put this component higher in the component tree.
*
* @example
* import { FetchProvider } from 'react-hooks-fetch';
*
* const App = () => (
*
* ...
*
* );
*/
export declare const FetchProvider: ({ initialInputs, children }: FetchProviderProps) => import("react").ReactElement<{
value: MapState;
}, string | import("react").JSXElementConstructor>;
export declare const useFetchState: (fn: FetchFunc) => FetchState | undefined;
export declare const useSetFetchState: (fn: FetchFunc) => (nextState: FetchState) => void;
export {};