UNPKG

cache-memo-fetch

Version:

useFetch react hook

23 lines (22 loc) 878 B
interface FetchOptions<T> extends RequestInit { parser?: (response: Response) => Promise<T>; fallback?: T; } interface CacheOptions { clear: () => void; clearUrl: (url: string) => void; stats: { get: number; post: number; other: number; total: number; }; } export declare function useFetch<T = unknown>(url: string, options?: FetchOptions<T>): T; export declare function useFetchText(url: string, options?: RequestInit): string; export declare function useFetchBlob(url: string, options?: RequestInit): Blob; export declare function useFetchBuffer(url: string, options?: RequestInit): ArrayBuffer; export declare function useFetchForm(url: string, options?: RequestInit): FormData; export declare function useFetchBytes(url: string, options?: RequestInit): Uint8Array; export declare const cache: CacheOptions; export {};