React-google-maps: error 'google' is not defined no-undef

Created on 20 Feb 2017  路  6Comments  路  Source: tomchentw/react-google-maps

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.

Most helpful comment

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

All 6 comments

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

@jwamsterdam - Take a look at #414

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

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

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

What about putting it in your tsconfig?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mahmood004 picture Mahmood004  路  3Comments

manoj150283 picture manoj150283  路  3Comments

julienvincent picture julienvincent  路  3Comments

EvHaus picture EvHaus  路  3Comments

PaulieScanlon picture PaulieScanlon  路  3Comments