You have included the Google Maps JavaScript API multiple times on this page
martyjg opened this issue · comments
Bug Report
I'm getting the following 2 errors when trying to use my autocomplete component:
You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors.
TypeError: Cannot read properties of undefined (reading 'Iv')
I'm following the getting started steps with loading the map script:
const GOOGLE_MAPS_URL =
https://maps.googleapis.com/maps/api/js?key=${process.env.NEXT_PUBLIC_PLACES_API_KEY}&libraries=places&callback=initMap`
This is happening as I'm trying to update react-dom to 18.1.0. The autocomplete does not work. The previous version major of react-dom doesn't give this error.
How to Reproduce
This is a next.js project.
- Follow the getting started steps
- Try to render page with the
use-autocomplete
Your Environment
- Device: MacBook Pro
- OS: macOS 12.2.1
- Browser: Chrome
- Version: 102.0.5005.61
I'm pretty sure it's related to React 18's StrictMode running useEffect twice.