wait-for-redux-thunk
Simple middleware providing hooks after every async action and a final callback when all async actions are completed. Very useful when building universal react applications with redux-thunk.
Installation
To install the stable version:
npm install --save wait-for-redux-thunk
Use ASYNC_START and ASYNC_END to mark async actions
; { return type: ASYNC_REQUEST payload: options meta: ASYNC_START ;} { return type: ASYNC_SUCCESS payload: data meta: ASYNC_END ;} { return type: ASYNC_ERROR payload: error meta: ASYNC_END ;}
And waitMiddleware with applyMiddleware from this module
;;;;;; // called before first renderconst initFn = {}; // called when each async action is completed,// should return string representing React applicationconst renderFn = ; // called when all async actions are completed,// provides the latest state and render stringconst finalFn = { const state = store; res;}; const createMidlewareStore = createStore;const store = ;
License
MIT