I have a search bar with the Google Maps Places Autocomplete. I am using the npm package 'react-places-autocomplete' in Next.js.
Is there any way to get the postal code in handleSelect?
import { geocodeByAddress, getLatLng } from 'react-places-autocomplete';
export default function CP({...}: Props) {
const handleSelect = async (address) => {
const results = await geocodeByAddress(address);
const latLng = await getLatLng(results[0]);
};
return (
<LocationSearchInput
address={state.address}
visible={visible}
handleChange={handleChange}
handleSelect={handleSelect}
/>
);
}