Skip to main content

foundation-redux.storereturn

Home > @genesislcap/foundation-redux > StoreReturn

StoreReturn type

The return type of the createStore function.

Signature:

export type StoreReturn<S extends SliceArray> = {
store: RootStateFromSlices<S>;
actions: ActionsFromSlices<S>;
selectors: SelectorsFromSlices<S>;
rootReducer: ReducersMapObject<RootStateFromSlices<S>>;
subscribeKey: (checkerFn: (s: RootStateFromSlices<S>) => string, callbackFn: (s: RootStateFromSlices<S>) => void) => void;
dispatch: (action: Action | ThunkDispatch<S>) => void;
notify: (sliceName: keyof RootStateFromSlices<S>) => void;
subscribe: (cb: (state: RootStateFromSlices<S>) => void) => void;
getState: () => RootStateFromSlices<S>;
};

References: SliceArray, RootStateFromSlices, ActionsFromSlices, SelectorsFromSlices, ThunkDispatch

Remarks

This type represents all the utilities and functions returned when creating a store. It provides access to the store state, actions, selectors, and subscription methods.

Example

const { store, actions, selectors, subscribeKey } = createStore(slices, initialState);