@nutgaard/use-fetch
Version:
A useFetch hook to be used with react@^16.8.0
18 lines (17 loc) • 601 B
TypeScript
declare class FetchCache {
private cache;
private resolvedCache;
fetch(key: string, url: string, init?: RequestInit): Promise<Response>;
get(key: string): Promise<Response>;
getResolved(key: string): any;
putResolved(key: string, value: object): void;
put(key: string, value: Promise<Response>): void;
remove(key: string): void;
clear(): void;
hasKey(key: string): boolean;
keys(): Array<string>;
hasKeyResolved(key: string): boolean;
size(): number;
}
declare const globaleFetchCache: FetchCache;
export default globaleFetchCache;