react-progress-2-redux

1.1.2 • Public • Published

example

import { Progress, reducer } from 'react-progress-2-redux'

class Application extends React.PureComponent {
    render () {
        return (
            <div>
                <Progress />
                {/* the content */}
            </div>
        )
    }
}

let store = createStore(
    combineReducers({
        progressRedux: reducer
    })
)

ReactDOM.render(
    <Provider store={store}>
        <Application />
    </Provider>,
    document.querySelector('#root')
)
import { show, hide } from 'react-progress-2-redux'

// your-reducer.jsx
export function loadUsers () {
    return async dispatch => {
        dispatch(show())
        await myCoolAsyncRequest()
        dispatch(hide())
    }
}

// your-reducer.jsx
export function loadTasks () {
    return async dispatch => {
        dispatch(show())
        dispatch(show())
        dispatch(show())
        let data = await myCoolAsyncRequest()
        dispatch(hideAll())
    }
}

Package Sidebar

Install

npm i react-progress-2-redux

Weekly Downloads

0

Version

1.1.2

License

MIT

Last publish

Collaborators

  • rsqw