Last active
December 28, 2017 18:00
-
-
Save Abazhenov/cae5b13c213be297d10b5d824f63feba 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
const mapDispatchToProps = (dispatch, ownProps) => ({ | |
getUser(id) { | |
dispatch(ownProps.getUser(id)) | |
} | |
}) | |
class MyFancyComponent extends React.Component { | |
// react things | |
} | |
export default connect(() => ({}), mapDispatchToProps)(MyFancyComponent) | |
/* | |
BECOMES | |
*/ | |
import { mapDispatchToProps } from '../myFancyDecorators' | |
@mapDispatchToProps((dispatch, ownProps) => ({ | |
getUser(id) { | |
dispatch(ownProps.getUser(id)) | |
} | |
})) | |
export default class MyFancyComponent extends React.Component { | |
// react things | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment