package.core.dist.index.d.ts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swr Show documentation
Show all versions of swr Show documentation
React Hooks library for remote data fetching
import * as react from 'react';
import * as swr__internal from 'swr/_internal';
import { FullConfiguration, Key, SWRHook } from 'swr/_internal';
export { Arguments, BareFetcher, Cache, Fetcher, Key, KeyLoader, KeyedMutator, Middleware, MutatorCallback, MutatorOptions, Revalidator, RevalidatorOptions, SWRConfiguration, SWRHook, SWRResponse, State, mutate, preload, useSWRConfig } from 'swr/_internal';
declare const SWRConfig: react.FC>> & Partial & {
provider?: ((cache: Readonly>) => swr__internal.Cache) | undefined;
}) | ((parentConfig?: (Partial>> & Partial & {
provider?: ((cache: Readonly>) => swr__internal.Cache) | undefined;
}) | undefined) => Partial>> & Partial & {
provider?: ((cache: Readonly>) => swr__internal.Cache) | undefined;
}) | undefined;
}>> & {
defaultValue: FullConfiguration;
};
declare const unstable_serialize: (key: Key) => string;
/**
* A hook to fetch data.
*
* @link https://swr.vercel.app
* @example
* ```jsx
* import useSWR from 'swr'
* function Profile() {
* const { data, error } = useSWR('/api/user', fetcher)
* if (error) return failed to load
* if (!data) return loading...
* return hello {data.name}!
* }
* ```
*/
declare const _default: SWRHook;
export { SWRConfig, _default as default, unstable_serialize };