Configure Google Maps API loading
masterYou have two ways to load the Google Maps scripts required for the package to work:
1. Automatic Loading (Recommended)
Pass the apiKey prop to the Autocomplete component or the usePlacesWidget hook. This will automatically load the necessary Google Maps scripts.
Note: The Places API and Maps JavaScript API must both be enabled in your Google Cloud Console.
2. Manual Loading
If you do not provide an apiKey prop, you must manually include the Google Maps script in your application (e.g., in index.html).
<script
type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=[YOUR_API_KEY]&libraries=places"
></script><Autocomplete
apiKey={YOUR_GOOGLE_MAPS_API_KEY}
onPlaceSelected={(place) => console.log(place)}
/>