UNPKG

react-hooks-global-states

Version:

A package to easily handle global state across your React components using hooks.

16 lines (15 loc) 1.02 kB
import type { CreateContext } from './types'; /** * @description Creates a highly granular React context with its associated provider and state hook. * Unlike the native `React.createContext`, this version provides fine-grained reactivity and supports * state selection, metadata handling, and optional custom actions for controlled mutations. * * Components using the generated hook only re-render when the selected part of the state changes, * making it efficient for large or deeply nested state trees. */ export declare const createContext: CreateContext; export default createContext; /** * Temporary re-export types for backwards compatibility */ export type { GlobalStoreContextCallbacks, GlobalStoreCallbacks, ContextActionCollectionResult, ContextActionCollectionConfig, ContextStoreToolsExtensions, ContextStoreTools, ContextProviderExtensions, ContextProvider, ReadonlyContextHook, ContextHook, ContextPublicApi, ReadonlyContextPublicApi, CreateContext, InferContextApi, InferStateApi, } from './types';