Created
March 14, 2017 18:20
-
-
Save irae/2b477ac733d43629442c9c4982727400 to your computer and use it in GitHub Desktop.
I love how mapDispatchToProps avoids a bound method on render
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
const {saveProfile, deleteProfile} = require('../actions/saved-profiles'); | |
function mapDispatchToProps(dispatch, ownProps) { | |
const {profile, savedId} = ownProps; | |
return { | |
saveProfile: () => { | |
dispatch(saveProfile(profile)); | |
}, | |
deleteProfile: () => { | |
dispatch(deleteProfile(savedId)); | |
}, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pretty nifty, thanks! Just what I was looking for.