Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error 'google' is not defined no-undef #434

Closed
jwamsterdam opened this issue Feb 20, 2017 · 6 comments
Closed

error 'google' is not defined no-undef #434

jwamsterdam opened this issue Feb 20, 2017 · 6 comments

Comments

@jwamsterdam
Copy link

jwamsterdam commented Feb 20, 2017

This doc: https://tomchentw.github.io/react-google-maps/basics/directions isn't working at all.

can't get around: error 'google' is not defined no-undef

I did find a solution that is partly working, e.g. using

  return (
       <GoogleMapLoader
               containerElement={mapContainer}
               googleMapElement={
                   <GoogleMap  
                       defaultZoom={12}
                       defaultCenter={this.props.center}
                       options={{ streetviewcontrol: false, mapTypeControl: true}}>
                   </GoogleMap>
               } 

But I have no idea how to match this to the tutorial with componentDidMount etc. to get it to work with the direction service. Any help is greatly appreciated.

@jwamsterdam
Copy link
Author

I am one step further, see this question: #435

@davidpatters0n
Copy link

@jwamsterdam - Take a look at #414

@tomchentw
Copy link
Owner

Please refer to Getting Help section in the README (or #469).

@voquockhanh
Copy link

voquockhanh commented Jun 19, 2017

add this line to top of your file: /*global google*/ -> for disable ESLint

@johnanisere
Copy link

const google=window.google solves this problem.You see this because reactjs use a linting rule that forbids unknown global variables.

deep-diver added a commit to deep-diver/neighborhood-map-react that referenced this issue May 3, 2018
- /*global google*/ is required when you face "error 'google' is not defined no-undef" (tomchentw/react-google-maps#434)
- need to put libraries=places in the URL
@quantuminformation
Copy link

What about putting it in your tsconfig?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants