redux-action-enhancer-middleware

1.0.1 • Public • Published

redux-action-enhancer-middleware

Middleware that provides an enhancing function to dispatched actions, with optional filtering to target only certain actions.

Install

npm i -S redux-action-enhancer-middleware

Example

import actionEnhancerMiddleware from 'redux-action-enhancer-middleware';
 
const options = {
  filter: (action) => true,
  enhancer: (dispatch, getState, action) => {...action}
};
 
const store = createStore(
  reducer,
  applyMiddleware(
    actionEnhancerMiddleware(options)
  )
);

API

redux-action-enhancer-middleware takes an options object with an optional filter and a required enhancer.

Filter

(action) => true

Function that receive an action and returns a boolean that determines if the enhancer should be invoked.

Enhancer

(dispatch, getState, action) => nextAction

Function that receives a dispatch, getState, and action. The enhancer returns an action.

Package Sidebar

Install

npm i redux-action-enhancer-middleware

Weekly Downloads

3

Version

1.0.1

License

MIT

Last publish

Collaborators

  • jurassix