use-s-react
Version:
useS is a minimal yet powerful React hook for managing both local and global state — with zero boilerplate
8 lines (7 loc) • 493 B
TypeScript
import type { DebugOptions, Listener } from "../types";
export declare function createState<T>(key: string, initial: T): void;
export declare function setGlobalState<T>(key: string, newValue: T): void;
export declare function subscribeToGlobalState(key: string, listener: Listener): () => void;
export declare function getGlobalSnapshot<T>(key: string): T;
export declare function debugGlobalStore(options?: DebugOptions): void;
export declare function isKeyInitialized(key: string): boolean;