Last active
May 28, 2017 21:00
-
-
Save joedski/74eec0241a904c87d768e2c042f9f84c to your computer and use it in GitHub Desktop.
Javascript: Redux: Dispatching Multiple Actions: React Redux Example
This file contains hidden or 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
export default connect( | |
null, | |
dispatch => ({ | |
doAllTheThings: dispatch(multiAction([ | |
doThisThing(), | |
doThatThing({ computer: 'over' }), | |
doTheOtherThing('foo'), | |
])), | |
}), | |
)(props => ( | |
<button onClick={props.doAllTheThings}>Do ALL the things!</button> | |
)); |
This file contains hidden or 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
export default connect( | |
null, | |
dispatch => ({ | |
// look ma, no extra action | |
doAllTheThings: dispatch([ | |
doThisThing(), | |
doThatThing({ computer: 'over' }), | |
doTheOtherThing('foo'), | |
]), | |
}), | |
)(props => ( | |
<button onClick={props.doAllTheThings}>Do ALL the things!</button> | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment