20.97.1 • Published 4 years ago

@pagoru/redux-middleware v20.97.1

Weekly downloads
18
License
MIT
Repository
github
Last release
4 years ago

Build status

@pagoru/redux-middleware

Simple redux middleware library, to create your own middleware.

Usage

import { createStore } from 'redux'
import { middleware, middlewareHandler } from 'redux-middleware'

// Create as many you need.
middlewareHandler(  
    (action, getState) => {  
	    // you can modify your action here
		console.log('will', action, getState());  
		return action;  
  }, (action, getState) => {  
        console.log('did', action, getState());  
  }  
);

const initialStore = {}
// Add the middleware to the createStore.
const store = createStore(rootReducer, initialStore, applyMiddleware(middleware));