Closed nitya-nalamari closed 4 months ago
This is much needed
Just change the way you load the api.
Use this:
import {useJsApiLoader} from "@react-google-maps/api";
const {isLoaded, loadError} = useJsApiLoader({ id: 'google-map-script', googleMapsApiKey: YOUR_GOOGLE_MAPS_KEY, });
useJsApiLoader
Just change the way you load the api.
Use this:
import {useJsApiLoader} from "@react-google-maps/api";
const {isLoaded, loadError} = useJsApiLoader({ id: 'google-map-script', googleMapsApiKey: YOUR_GOOGLE_MAPS_KEY, });
when you use hooks the component must be client. how to protect the api key?
you are setting CORS in google api console per key. so basically limit the key to your domain name
Reason:
The
make-load-script-url
file does not addloading=async
to its script. This results in a warning that google maps api should be loaded asynchronously for optimal performance.Ref: https://developers.google.com/maps/documentation/javascript/overview
Issue: #3334