Hello,
How would i wrap the GoogleApiWrapper with react-redux's connect?
I would imagine I have to have wrap export GoogleApiWrapper with the connect's mapStateToProps and mapDispatchToProps. Like so:
export default GoogleApiWrapper({
apiKey: __APIKEY___
}, mapStateToProps, mapDispatchToProps)(Container)
But it is not working. Do I have to change how the GoogleApiWrapper's exports? Anyone can point me to the right direction? @auser
Thanks!
Hey @ranleung
Yeah, you should wrap the Container, not the export, i.e.:
const WrappedContainer = GoogleApiWrapper({
apiKey: __APIKEY___
})(Container);
export default WrappedContainer
awesome!! thank you! :)
closing...
Hi ranleung,
I have the same trouble,
Could you tell me how can i set mapDispatchToProps with GoogleApiWrapper?
Please, help me.
Thank you @auser. I have also faced the same trouble. Now seems working after making the changes as you mentioned above.
const WrappedContainer = GoogleApiWrapper({
apiKey: MAPKEY
})(TrackManagerComponent);
export default connect(mapToProps, { GetUsers, GetTrackDetails })(withStyles(styles)(WrappedContainer));
Most helpful comment
Hey @ranleung
Yeah, you should wrap the
Container, not the export, i.e.: