Skip to content

error: use-places-autocomplete: Google Maps Places API library must be loaded. #883

Answered by nonoumasy
nonoumasy asked this question in Q&A
Discussion options

You must be logged in to vote

So I was able to resolve the issue using the Script tag inside a useEffect inside the component.

import Script from "next/script"

useEffect(() => {
    ;<Script
      src={`https://maps.googleapis.com/maps/api/js?key=${process.env.NEXT_PUBLIC_PLACES_AUTOCOMPLETE}&libraries=places`}
    />
  }, [])

However I'm still unable to use the asynchronous script loading.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by nonoumasy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants