@jupri-lab/react-store
Version:
A lightweight, easy-to-integrate, and type-safe state management library for React
12 lines (7 loc) • 660 B
TypeScript
import { Store, TAction, IStoreConfigs } from '@jupri-lab/store-core';
declare const combineStores: <TStores extends Record<string, Store<any, any>>>(stores: TStores) => <TSelectedStore extends Store<any, any>>(selector: (stores: TStores) => TSelectedStore, subscribe?: boolean) => TSelectedStore;
interface IUseStoreOptions {
subscribe?: boolean;
}
declare function createStore<TInitialState extends object, TActions extends Record<string, TAction<TInitialState, any>>>(storeConfigs: IStoreConfigs<TInitialState, TActions>): (options?: IUseStoreOptions) => Store<TInitialState, TActions>;
export { type IUseStoreOptions, combineStores, createStore };