React-google-maps: Google is undefined

Created on 8 Jan 2018  路  4Comments  路  Source: tomchentw/react-google-maps

When running the example shown here (copy/paste):

image

The following error is displayed:
image

It's unclear in the documentation how to make it... "wait to render???".... the DrawingManager with the global google object which is not set until the GoogleAPI comes back.

Most helpful comment

I think the google object is attached to the window, so try using window.google.maps....

All 4 comments

I think the google object is attached to the window, so try using window.google.maps....

if you're using create react app, use window.google
https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#using-global-variables

I think the google object is attached to the window, so try using window.google.maps....

omg thank you!!

use window.google....

Was this page helpful?
0 / 5 - 0 ratings