higher-order reducer to ignore redux actions
npm install --save redux-ignore
redux-ignore
is a reducer enhancer (higher-order reducer), it provides the
ignoreActions
function, which takes an existing reducer and an array of
actions to be ignored.
Firstly, import redux-ignore
:
// Redux utility functions
import { combineReducers } from 'redux';
// redux-ignore higher-order reducer
import ignoreActions from 'redux-ignore';
Then, add ignoreActions
to your reducer(s) like this:
combineReducers({
counter: ignoreActions(counter, [INCREMENT_COUNTER])
})
Now you won't be able to increment the counter anymore, because the
INCREMENT_COUNTER
action is ignored.
Have a read of the Implementing Undo History recipe in the Redux documents, which explains in detail how higher-order reducers work.
MIT, see LICENSE.md
for more information.