Last active
September 6, 2018 20:58
-
-
Save yoshi415/7e4b3ac2914117be26dce76ff557da0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// previous | |
componentWillMount() { | |
const { fetchSchedule, someOtherMethod, taskerInfo: { user_id } } = this.props; | |
fetchSchedule(user_id); | |
someOtherMethod(); | |
} | |
export default connect(mapStateToProps, { | |
...recommendationActions, | |
...taskerScheduleActions, | |
...calendarActions, | |
})(TaskerScheduleModal); | |
// proposed | |
import { bindActionCreators } from 'redux'; | |
componentWillMount() { | |
const { calendarActions, taskerScheduleActions, taskerInfo: { user_id } } = this.props; | |
taskerScheduleActions.fetchSchedule(user_id); | |
calendarActions.someOtherMethod(); | |
} | |
const mapDispatchToProps = dispatch => ({ | |
recommendationActions: bindActionCreators(recommendationActions, dispatch), | |
taskerScheduleActions: bindActionCreators(taskerScheduleActions, dispatch), | |
calendarActions: bindActionCreators(calendarActions, dispatch), | |
}); | |
export default connect(mapStateToProps, mapDispatchToProps)( | |
TaskerScheduleModal | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment