Skip to content

Instantly share code, notes, and snippets.

@moreta
Last active January 16, 2016 17:00
Show Gist options
  • Save moreta/195cdc8e98f22d9a9646 to your computer and use it in GitHub Desktop.
Save moreta/195cdc8e98f22d9a9646 to your computer and use it in GitHub Desktop.
redux multi action creator
// https://github.com/rackt/react-redux/blob/master/docs/api.md#inject-todos-and-todoactioncreators-and-counteractioncreators-together-as-actions
import * as todoActionCreators from './todoActionCreators'
import * as counterActionCreators from './counterActionCreators'
import { bindActionCreators } from 'redux'
function mapStateToProps(state) {
return { todos: state.todos }
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(Object.assign({}, todoActionCreators, counterActionCreators), dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(TodoApp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment