NOTE: fork of https://github.com/omnidan/redux-ignore
higher-order reducer to ignore redux actions
yarn add @zumper/redux-ignore
@zumper/redux-ignore is a reducer enhancer (higher-order reducer), it provides the
ignoreActions function, which takes an existing reducer and either:
- An array of actions to be ignored, or...
- A predicate function for filtering out actions.
// Redux utility functions// redux-ignore higher-order reducer
ignoreActions to your reducer(s) like this:
Now you won't be able to increment the counter anymore, because the
INCREMENT_COUNTER action is ignored.
Alternatively, you can ignore actions via a predicate function:
You can also use
filterActions to only accept actions that are declared in an array, or that satisfy the predicate function:
What is this magic? How does it work?
Have a read of the Implementing Undo History recipe in the Redux documents, which explains in detail how higher-order reducers work.
LICENSE.md for more information.