UNPKG

react-google-geocoding

Version:

A lightweight wrapper around Google Places Autocomplete and Directions APIs.

28 lines (27 loc) 886 B
interface GeocodingResult { coordinates: { lat: number | null; lng: number | null; }; zipCode: string | null; country: string | null; province: string | null; } /** * A hook that fetches geocoding information using Google Geocoding API. * * @returns {GeocodingResult} An object containing: * - `coordinates`: The latitude and longitude as `{ lat, lng }`. * - `zipCode`: The postal code as a string or `null`. * - `country`: The country name as a string or `null`. * - `province`: The province or state as a string or `null`. * * @example * const { coordinates, zipCode, country, province } = useGoogleGeocoding(); * * if (coordinates.lat && coordinates.lng) { * console.log(`Latitude: ${coordinates.lat}, Longitude: ${coordinates.lng}`); * } */ declare const useGoogleGeocoding: () => GeocodingResult; export { useGoogleGeocoding };