0.1.0 • Published 7 years ago
react-redux-shared-dispatch v0.1.0
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);
0.1.0
7 years ago