redux-loading
v1.0.0 redux loading redux-loading
redux-loading
Loading control with Redux
Example
import {createStore, combineReducers, applyMiddleware} from 'redux'
import {loadingReducer, loadingMiddleware} from 'redux-loading'
const store = createStore(
combineReducers({
loading: loadingReducer
}),
applyMiddleware(loadingMiddleware)
)
let action = {
type: 'SOME_ACTION',
meta: {
loading: true
}
}
store.dispatch(action)
let state = store.getState()
//state = {loading: {pending: 1, done: false}}
action = {
type: 'SOME_OTHER_ACTION',
meta: {
loading: false
}
}
store.dispatch(action)
state = store.getState()
//state = {loading: {pending: 0, done: true}}
npm i [email protected]
Metadata
- MIT
- Whatever
- Reinaldo Schiehll
- released 3/27/2016