swr-global-state
Version:
Zero-setup & simple global state management for React Components
19 lines • 779 B
TypeScript
import type { SWRConfiguration } from 'swr';
import { type StoreParams, useStore } from './lib/useStore';
/**
* Create custom hooks that wraps `useStore` to another function.
* @param {StoreParams<T>} data state that to be shared or cached
* @see https://github.com/gadingnst/swr-global-state#creating-a-store
*/
export declare function createStore<T, E = any>(data: StoreParams<T>, swrConfig?: SWRConfiguration): (initial?: T) => readonly [T, import("./lib/useStore").StateMutator<T>, import("swr").SWRResponse<T, E, any> & {
isLoading: boolean;
error: E;
isPersisting: boolean;
}];
export * from './lib/useStore';
declare const sgs: {
createStore: typeof createStore;
useStore: typeof useStore;
};
export default sgs;
//# sourceMappingURL=index.d.ts.map