Skip to content

eddy0/light-redux-loading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

light-redux-loading

a light scale of redux loading

loadingbar

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())
        })
    }
}

About

personal light scale of redux loading

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published