A loading queue for Redux
npm install --save @chegg/redux-loading-queue
Add the loadingReducer
to your store under loading
.
import { createStore, combineReducers } from 'redux'
import { loadingReducer } from '@chegg/redux-loading-queue'
const store = createStore(
combineReducers({
loading: loadingReducer
})
)
To add or remove an item with a certain id to the loading queue, use the provided actions.
import { loadingShow, loadingHide } from '@chegg/redux-loading-queue'
const uuid = '123e4567-e89b-12d3-a456-426655440000'
store.dispatch(loadingShow(uuid))
store.dispatch(loadingHide(uuid))
Wrap your loading view with AppLoading
.
The view will show as long as at least one item is in the queue.
<AppLoading>
<div>Loading..</div>
</AppLoading>
Philip Stewart (@sodoku)
Yvan Volochine (@gusano)
Apache v2, Copyright 2016 Chegg Inc.