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
Is there any way you could add Promise-based versions of placesAutocompleteService.current.getPlacePredictions and placesAutocompleteService.current.getQueryPredictions in your usePlacesAutocompleteService hook?
This way, users could use the usePlacesAutocompleteService hook inline with promises instead of having to listen to updates to the placePredictions variable inside of a useEffect like you have in your example:
useEffect(()=>{// fetch place details for the first element in placePredictions arrayif(placePredictions.length)placesService?.getDetails({placeId: placePredictions[0].place_id,},(placeDetails)=>savePlaceDetailsToState(placeDetails));},[placePredictions]);
Thanks!
Nick
The text was updated successfully, but these errors were encountered:
Hi @ErrorPro
Is there any way you could add Promise-based versions of
placesAutocompleteService.current.getPlacePredictions
andplacesAutocompleteService.current.getQueryPredictions
in yourusePlacesAutocompleteService
hook?Currently they look like:
but they could be wrapped like this:
This way, users could use the
usePlacesAutocompleteService
hook inline with promises instead of having to listen to updates to theplacePredictions
variable inside of auseEffect
like you have in your example:Thanks!
Nick
The text was updated successfully, but these errors were encountered: