redux-landing

1.0.1 • Public • Published

Initialize redux state asynchronously with multiple async actions.

Install

npm install --save redux-landing

Usage

import { createStore, applyMiddleware } from "redux";
import landing from "redux-landing";
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 asyncDispatch = landing(rootReducers, ...middlewares);
asyncDispatch(...initActions).then((preloadedState) => {
    const enhancer = applyMiddleware(...middlewares);
    const store = createStore(rootReducers, preloadedState, enhancer);
});

Package Sidebar

Install

npm i redux-landing

Weekly Downloads

0

Version

1.0.1

License

ISC

Last publish

Collaborators

  • junhua