Redux Loading Middleware.
A redux middleware to handle global loading fully compatible with redux and redux-zero
Usage
Redux loading middleware set a loading state for every unresolved action that returns a promise, after promise resolution, it set's loadings state to false. Also it chains action unresolved promises that runs within 200ms threshold, and set loading to false only when every promise is done.
Install
npm install redux-loading-middleware --save
Add to your redux project
;;;; const initialState = todos: loading: false; const store = ; ;
Add to your redux-zero project
;; const initialState = todos: loading: false; const middlewares = ;const store = ; ;
Skipping loading
To skip loading, just set global skipLoading
variable to true.
To enable loading, set global skipLoading
to false.
// redux-zero exempleconst actions = { state return // ... }