Method Middleware for Redux
Install
npm i --save redux-method-middleware
Setup
;;;; const logger = ;const store = ; // Note passing middleware as the third argument requires redux@>=3.1.0
Usage
// implementation Store;
What this does will first dispatch to the store our action with readyState
to loading. Our async method will be called and when the callback returns, if an error has occured we dispatch our action with readyState
error
. If all successful, readyState
is success
, and you're good to go.