nolimitstore
Version:
A lightweight Redux-like store for React and React Native, with hooks and selector support. Built with TypeScript, no boilerplate, and full reactivity via useSyncExternalStore.
11 lines (10 loc) • 384 B
TypeScript
export type Action = {
type: string;
} & Record<string, any>;
export type Reducer<S> = (state: S, action: Action) => S;
export type Store<S> = {
getState: () => S;
dispatch: (action: Action) => void;
subscribe: (listener: () => void) => () => void;
};
export declare function createStore<S extends Record<string, any>>(initialState: S, reducer: Reducer<S>): Store<S>;