@ace-fetch/react
Version:
react adapter for @ace-fetch/core.
26 lines (25 loc) • 813 B
TypeScript
/// <reference types="react" />
import type { Fetch, FetchConsumerProps } from '../types';
/**
* activeFetch must be called to handle SSR at the top of functions like
* `fetch`, `setup`, `serverPrefetch` and others
*/
export declare let activeFetch: Fetch | undefined;
/**
* fetch context
*/
export declare const FetchContext: import("react").Context<FetchConsumerProps>;
/**
* Set or unset active fetch, Used in SSR and internally when calling
* actions and getters
* @param fetch Fetch instance
*/
export declare const setActiveFetch: (fetch: Fetch | undefined) => Fetch | undefined;
/**
* get fetch from context
*/
export declare const getContextFetch: () => Fetch | undefined;
/**
* Get the currently active fetch if there is any.
*/
export declare const getActiveFetch: () => Fetch | undefined;