Last active
January 16, 2016 17:00
-
-
Save moreta/195cdc8e98f22d9a9646 to your computer and use it in GitHub Desktop.
redux multi action creator
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
// 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