You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+31-41
Original file line number
Diff line number
Diff line change
@@ -67,21 +67,16 @@ To use this hook, there're two things we need to do:
67
67
68
68
### Load the library
69
69
70
-
Use the `script` tag to load the library in your project.
70
+
Use the `script` tag to load the library in your project and pass the value of the `callback` parameter to the [callbackName](#parameter-optional) option.
> ⚠️ If you got a global function not found error. Make sure `usePlaceAutocomplete` is declared before the script was loaded.
79
+
> ⚠️ If you got a global function not found error. Make sure `usePlaceAutocomplete` is declared before the script was loaded. You can use the [async or defer](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attributes) attribute of the `<script>` element to achieve that.
|`requestOptions`| object || The [request options](https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#AutocompletionRequest) of Google Maps Places API except for `input` (e.g. bounds, radius etc.). |
300
296
|`googleMaps`| object |`window.google.maps`| In case you want to provide your own Google Maps object, pass the `google.maps` to it. |
301
-
|`callbackName`| string ||You can provide a callback name to initialize `usePlacesAutocomplete` after Google script is loaded. It's useful when you [load the script asynchronously](#load-the-library). |
297
+
|`callbackName`| string ||The value of the `callback` parameter when [loading the Google Maps JavaScript library](#load-the-library).|
302
298
|`debounce`| number |`200`| Number of milliseconds to delay before making a request to Google Maps Places API. |
303
299
|`cache`| number \| false |`86400` (24 hours) | Number of seconds to [cache the response data of Google Maps Places API](#cache-data-for-you). |
304
300
|`cacheKey`| string |`"upa"`| Optional cache key so one can use multiple caches if needed. |
0 commit comments