Set API_KEY from props?
benjick opened this issue · 5 comments
benjick commented
I'm only getting API_KEY
via props, is there a way to pass that to GoogleMapLoader
?
cedricdelpoux commented
Did you try this :
const API_KEY = ...
googleMapsLoader(YourComponent, {
libraries: ["places", "geometry"],
key: API_KEY,
})
benjick commented
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?
cedricdelpoux commented
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
benjick commented
@xuopled Thank you! That sounds awesome
cedricdelpoux commented
@benjick Check out the ReactGoogleMapsLoader v4.0.0 I juste release !