redux-reset-store
Higher Order Reducer for resetting multiple parts of your state tree
Wrap any of your Reducers with this higher order reducer to clear state when a certain action is dispatched.
composeResetReducer(reducerFn, initialState, resetType)
Arguments
-
reducer
(Function): A reducing function that returns the next state tree given the current state tree and an action to handle. -
[
initialState
] (any): The initial state. This is the value you want to reset the state to when the preferred action type is dispatched -
[
resetType
] (string): Preferred Action Type to trigger reset in state. Default is"RESET_STATE"
Example
;; // current state after init = falseconst toggleReducer = ; // Default action type is RESET_STATEstore; // current state after toggle = truestore;// current state after reset = false