react-redux-shared-dispatch

0.1.0 • Public • Published

Small library which allow you to dispatch multiple redux actions and only perform it once, to prevent multiple components firing multiple AJAX calls.

import sharedDispatch from "react-redux-shared-components";
 
class MyComponent extends React.Component {
  componentDidMount() {
    this.props.onRequestData();
  }
  
  render() { return <div/>}
}
 
const mapDispatchToProps = {
  onRequestData: () => async (dispatch) => {
    // Excute AJAX calls
  }
};
 
export default sharedDispatch(mapDispatchToProps)(MyComponent);

Readme

Keywords

none

Package Sidebar

Install

npm i react-redux-shared-dispatch

Weekly Downloads

3

Version

0.1.0

License

none

Last publish

Collaborators

  • tryingtoimprove