Created
October 26, 2018 01:16
-
-
Save rmcauley/437f947788786a3948e202952fb7703c 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
function blah(props) { | |
return <div onClick={props.doThing}>{props.id}</div> | |
} | |
const mapStateToProps = state => ({id: state.thing.id}); | |
const mapDispatchToProps = dispatch => ({ | |
doThing: () => { | |
callMyApi('doThing', {iWantMappedProps.id}); | |
}, | |
}); |
const mapDispatchToProps = dispatch => ({
doThing: (thing) => {
callMyApi('doThing', thing);
},
});
class Blah extends React.Component {
doThing () {
this.props.doThing(this.props.id)
}
you know the rest
mapDispatchToProps = dispatch => {
doThing: {
return dispatch((localDispatch, getState) => {
const mappedProps = mapStateToProps(getState());
});
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
return <div onClick={() => props.doThing(state.thing.id)}>{props.id}</div>