Retrieve the user’s current geographic location with useGeoLocation.
useGeoLocation
hook provides a simple way to retrieve the user’s current geographic location. This is useful for applications that need to display or use location-based data, such as maps, weather information, or location-based services. The hook handles the process of fetching the location and provides both the location data and any potential errors.
Name | Type | Description |
---|---|---|
location | object | The location object containing geographic coordinates (latitude and longitude ) and other metadata. |
error | object | An error object if there was an issue retrieving the location, or null if no errors occurred. |