cedricdelpoux/react-google-places-suggest

Set API_KEY from props?

benjick opened this issue · 5 comments

I'm only getting API_KEY via props, is there a way to pass that to GoogleMapLoader?

Did you try this :

const API_KEY = ...
googleMapsLoader(YourComponent, {
  libraries: ["places", "geometry"],
  key: API_KEY,
})

Yeah, but I mean the only place I have access to API_KEY is in props, like this.props.apiKey or whatever. Is there any way I can pass it into googleMapsLoader from those?

I understand now. I don't know the markup to do want you want but maybe there is a way.
Nevermind, I plan to release a new version of this plugin using renderProps and not an HOC anymore. It should be ok for you after that

@xuopled Thank you! That sounds awesome

@benjick Check out the ReactGoogleMapsLoader v4.0.0 I juste release !