Skip to content

Initialize redux state asynchronously with multiple async actions.

Notifications You must be signed in to change notification settings

jBox/redux-dispatch-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Initialize redux state asynchronously with multiple async actions.

Install

npm install --save redux-dispatch-monitor

Usage

import { createStore, applyMiddleware, compose } from "redux";
import monitor from "redux-dispatch-monitor";
import thunk from "redux-thunk";
import customizedMiddleware from "./middlewares/customized";
import rootReducers from "./reducers";
import { action1, action2, actionN } from "./actions";

const middlewares = [thunk, customizedMiddleware];
const initActions = [
    action1(params),
    action2(params),
    actionN(params)
];

const enhancer = compose(monitor, applyMiddleware(...middlewares));
const store = createStore(rootReducers, enhancer);
monitor.dispatch(...initActions).done((preloadedState) => {
    // do some things initializing
})

About

Initialize redux state asynchronously with multiple async actions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published