Google places autocomplete - get latitude/longitude for database

Oh, now I see

Your custom code returns a list of objects, where at this moment only one object, is that correct?

[ { lat, lng } ]

and you would like to read these lat,lng properties, am I right?

if so, you’ve got two options:

  1. return from the custom code only one object
const firstResult = geocoderResponse.results[0]

if(firstResult){
  const lat = firstResult.geometry.location.lat()
  const lng = firstResult.geometry.location.lng()
  
  return { lat, lng }
}

return something when there is no items
  1. get in the codeless the first object from the result