Google-maps-react: Google Maps JavaScript API multiple times on this page

Created on 9 Nov 2018  路  7Comments  路  Source: fullstackreact/google-maps-react

Hi,

I have been the necessity of has a in my browser head, how I do?

Html in head:

Most helpful comment

Hello there , I am getting the same issue as mentioned above . I am using the google-maps-react to render map and using react-geosuggest library for populating google places autocomplete field.I have added the script in head html

and experiencing the same error
"You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors."

I tried removing GoogleApiWrapper and it doesn't load the google map. What can I do for handling it ?

All 7 comments

You should be able to use the wrapper directly without using the google maps shim

@auser Could you elaborate? I need the script in my index.html because I am using the places api elsewhere in my app. How do I prevent importing it a second time while using google-maps-react?

Ok never mind, I understood what you meant. There is no need to use GoogleApiWrapper which I was using. :)

Ok never mind, I understood what you meant. There is no need to use GoogleApiWrapper which I was using. :)

Yes! We can access the google object from the window object if we load the script separaetly

Hello there , I am getting the same issue as mentioned above . I am using the google-maps-react to render map and using react-geosuggest library for populating google places autocomplete field.I have added the script in head html

and experiencing the same error
"You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors."

I tried removing GoogleApiWrapper and it doesn't load the google map. What can I do for handling it ?

same here! What can I do? Not clear from the above.

It does work by using the window.google instead of the wrapper, but I still get the error message for loading the API multiple times!
I DON'T WANT it to be loaded in the wrapper or the component, because I have the scripts for loading the api (and other important things related to the maps api) somewhere else.

Is there a way to avoid this component from loading its own version of the maps api?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

samirbraga picture samirbraga  路  3Comments

ktosiek picture ktosiek  路  3Comments

t1a2l picture t1a2l  路  5Comments

carmen79 picture carmen79  路  4Comments

lishi500 picture lishi500  路  4Comments