arcx
Version:
A lightweight, dependency-free fetch utility for APIs and React.
26 lines • 856 B
TypeScript
import { FetchOptions } from "./fetchRequest";
/**
* Extended React-specific options for useFetch.
*/
export interface UseFetchOptions extends FetchOptions {
/**
* If `true`, the fetch call will not run on mount.
* You must call `refetch()` manually.
*/
manual?: boolean;
}
/**
* Provides data, loading state, error state, and a `refetch` function for
* a given URL and options. Uses the ArcX fetchRequest under the hood.
*
* @template T - The expected shape of the fetched data.
* @param url - The endpoint or path for the request.
* @param options - Additional ArcX/React options (manual, etc.).
*/
export declare function useFetch<T>(url: string, options?: UseFetchOptions): {
data: T | null;
isLoading: boolean;
error: Error | null;
refetch: () => Promise<void>;
};
//# sourceMappingURL=useFetch.d.ts.map