Skip to content

redux duck for adding isFetching errorFetching props to a given container component

Notifications You must be signed in to change notification settings

export-mike/request-duck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

request-duck

redux duck for adding isFetching error props to a given container component, scoped so props do not clash.

import {reducer as request} from './';

export default combineReducers({
  request,
  ... // other reducers
});


import request from './';

class Container extends Component {

 componentWillMount() {
  this.props.request(() => this.props.actions.fetchDataFromApi());
 }
 
 render() {
    return (
      { props.myContainer.isFetching && <div> {'Loading ...'}</div>}
      { props.myContainer.error && <div> {'Error Loading'} </div> }
    );
  }
}

export default request(
  scope: 'myContainer'
)(Container);

About

redux duck for adding isFetching errorFetching props to a given container component

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published