JustFly1984 / react-google-maps-api

React Google Maps API
MIT License
1.75k stars 426 forks source link

Problem with autocomplete #3280

Closed Hropotova closed 10 months ago

Hropotova commented 10 months ago

everything was fine with autocomplete for about a year, but yesterday this error appeared and I don't understand why I have it problem

© > Uncaught TypeError: Cannot read properties of undefined (reading 'location')

IMG_4153 IMG_4154 IMG_4155

clelantoson commented 10 months ago

Probably you need to check that place and geometry are defined

on my side I have no issue and it's typed like this

  const onDepartureAutocompletePlaceChanged = () => {
    setDepartureCoordinates(autocompleteDepartureRef.current?.getPlace()?.geometry?.location)
  }