"You have included the Google Maps JavaScript API multiple times on this page"
See original GitHub issueI’m getting this error in the console when using this component:
You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors.
And sometimes (not all the time - sometimes it works fine but still throws the above warning) when I type in a place name in the rendered component, the dropdown is stuck at “Loading…”.
I did have another Google Maps related fetch that I thought was causing the warning but I’ve removed that to see if it might solve the issue but no dice.
Here’s my import
import GooglePlacesAutocomplete from 'react-google-places-autocomplete';
And here’s a stripped down version of how I’m calling the component
const NewHorse = props => {
const [location, setLocation] = useState({});
const [places, setPlaces] = useState([]);
const setLocationState = data => {
setLocation({
id: data.id,
description: data.description
});
}
const GetLocation = () => {
if (places.length > 0) {
// return a select element with places
console.log(places);
// return <Select className="horse-form-select horse-form-input places" options={places} defaultValue={places[0]} onChange={onPlacesChange} />
} else {
return <GooglePlacesAutocomplete onSelect={setLocationState} apiKey={props.firebaseAPIKey} placeholder="Enter a city or zip code" autocompletionRequest={{types: ["(regions)"]}} />
}
}
return (
<Form className="horse-form">
<div className="horse-form-container">
{/* Location */}
<Label className="horse-form-label" for="location">Location</Label>
<div className="location">
{/* <MdLocationSearching fill="white" className="location-icon" onClick={getLocation} /> */}
<GetLocation />
</div>
</div>
</Form>
)
}
Any help is greatly appreciated.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
"You have included the Google Maps API multiple times on ...
I'm getting the error "You have included the Google Maps API multiple times on this page. This may cause unexpected errors." I know...
Read more >You have included the Google Maps JavaScript API multiple ...
Got a problem with this You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors...
Read more >You have included the Google Maps API multiple times on this ...
If two or more plugins (or theme) load the Google Maps API, and the library is loaded twice, a javascript error will occur...
Read more >Fix: Google Maps JavaScript API Multiple Times On This Page ...
An error can be shown in the console when you are using JavaScript API multiple times on your page, that says: "You have...
Read more >You have included the Google Maps API multiple times on this ...
Hi there, Need help to debug: "You have included the Google Maps API multiple times on this page. This may cause unexpected errors....
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 FreeTop 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
Top GitHub Comments
@cwinters8 Thanks again for reporting this!
A new fixed version
2.0.6
is already published 😄Cool! Also, thanks very much for the great library. It’s super handy and has already saved me a lot of headaches.