Google-maps-react: Wrap GoogleApiWrapper with react-redux's connect

Created on 9 Sep 2016  路  4Comments  路  Source: fullstackreact/google-maps-react

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!

Most helpful comment

Hey @ranleung

Yeah, you should wrap the Container, not the export, i.e.:

const WrappedContainer = GoogleApiWrapper({
   apiKey: __APIKEY___
})(Container);
export default WrappedContainer

All 4 comments

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));

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Vijayan-Murugan picture Vijayan-Murugan  路  4Comments

matgargano picture matgargano  路  5Comments

lishi500 picture lishi500  路  4Comments

carmen79 picture carmen79  路  4Comments

samirbraga picture samirbraga  路  3Comments