error 'google' is not defined no-undef
See original GitHub issueThis 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.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
'Google' is not defined: adding Google Maps API in React JS
Okay, this seems to work: The solution was to implicitly define google in a variable above the class, like this: const google =...
Read more >Reference Error: google is not defined
Hi All, I am trying to execute javascript through Qt script. My javascript contains code for google maps API. ... Error: google is...
Read more >Google Maps API Common Errors & Solutions - SoftAuthor
2. Google is not defined ... Scenario #1: When you are trying to create a Google Maps Map Object without including the Maps...
Read more >How do import a javascript file on /scripts/routes/common.js?
28:23 error 'google' is not defined no-undef 62:33 error Missing trailing comma comma-dangle 66:26 error 'google' is not defined no-undef
Read more >Uncaught ReferenceError: google is not defined - MSDN
Usually this type of error is due to forgetting to reference a JavaScript library or trying to access a library object before the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
add this line to top of your file:
/*global google*/
-> for disable ESLintconst google=window.google
solves this problem.You see this because reactjs use a linting rule that forbids unknown global variables.