Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load google maps asynchronously #3339

Merged
merged 2 commits into from
Mar 5, 2024

Conversation

nitya-nalamari
Copy link
Contributor

@nitya-nalamari nitya-nalamari commented Feb 24, 2024

Reason:

The make-load-script-url file does not add loading=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

@MohammedWaheeb
Copy link

This is much needed

@antoniocolelli
Copy link

antoniocolelli commented Mar 1, 2024

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,
});

@JustFly1984 JustFly1984 merged commit 31fd3db into JustFly1984:develop Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants