1.0.3 • Published 6 years ago
light-redux-loading v1.0.3
light-redux-loading
a light scale of redux loading
npm
yarn add light-redux-loading
core
limport loadingReducer from 'light-redux-loading'
import {
LoadingBar
showLoading,
hideLoading,
} from 'light-redux-loading'
useage
component
import LoadingBar from 'light-redux-loading'
export default class Header extends React.Component {
render() {
return (
<header>
<LoadingBar />
</header>
)
}
}
reducers
import { combineReducers } from 'redux'
import { loadingReducer } from 'light-redux-loading'
const reducer = combineReducers({
loading: loadingReducer,
})
action
import { showLoading, hideLoading } from 'light-redux-loading'
const handleInitalAction = () => {
return (dispatch) => {
dispatch(showLoading())
API().fetchData()
.then((data) => {
dispatch(handleInitaldata(data))
dispatch(hideLoading())
})
}
}