react-google-maps icon indicating copy to clipboard operation
react-google-maps copied to clipboard

error 'google' is not defined no-undef

Open jwamsterdam opened this issue 9 years ago • 6 comments

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 avatar Feb 20 '17 19:02 jwamsterdam

I am one step further, see this question: https://github.com/tomchentw/react-google-maps/issues/435

jwamsterdam avatar Feb 20 '17 21:02 jwamsterdam

@jwamsterdam - Take a look at #414

davidpatters0n avatar Feb 26 '17 20:02 davidpatters0n

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

tomchentw avatar Apr 20 '17 06:04 tomchentw

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

voquockhanh avatar Jun 19 '17 16:06 voquockhanh

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

johnanisere avatar Jan 09 '18 15:01 johnanisere

What about putting it in your tsconfig?

quantuminformation avatar May 01 '19 11:05 quantuminformation