# usegeoaddress

> usegeoaddress is a lightweight npm package that retrieves users' current location, including city, district, and region details. It also handles location permission errors seamlessly for a smooth user experience.

Latest version **2.2.1** (published 2023-10-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install usegeoaddress
pnpm add usegeoaddress
yarn add usegeoaddress
bun add usegeoaddress
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2023-10-03 |
| First published | 2023-10-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | therohantomar@gmail.com |
| Maintainers | therohantomar |
| Keywords | usegeoAddress, geo-location, useGeoLocation, geolocation, user, location, current, location, precise, location, location, details, city, district, region, coordinates, latitude, longitude, user, experience, permission, handling, npm, package, address |

## Links

- npm: https://www.npmjs.com/package/usegeoaddress
- Repository: https://github.com/therohantomar/usegeoaddress
- Homepage: https://github.com/therohantomar/usegeoaddress#readme
- Issues: https://github.com/therohantomar/usegeoaddress/issues
- npm.io page: https://npm.io/package/usegeoaddress

## Recent versions

- 2.2.1 (latest) — 2023-10-03
- 2.2.0 — 2023-10-03
- 2.1.0 — 2023-10-03
- 2.0.0 — 2023-10-03
- 1.9.0 — 2023-10-03
- 1.8.0 — 2023-10-03
- 1.7.0 — 2023-10-03
- 1.6.0 — 2023-10-03
- 1.3.0 — 2023-10-03
- 1.2.0 — 2023-10-03
- 1.1.0 — 2023-10-03
- 1.0.0 — 2023-10-03

## README

# usegeoaddress Hook

## Description

The usegeoaddress hook is a custom hook that allows retrieving the user's geolocation address using the browser's Geolocation API. This hook simplifies the process of fetching and managing the address information associated with a given latitude and longitude.

## Installation

To install the usegeoaddress hook, follow these steps:


    Make sure you have React installed in your project.


   $ npm install react



    Install the usegeoaddress hook using npm or yarn.

```bash
   $ npm install usegeoaddress
```
```bash
   $ yarn add usegeoaddress
```

## Usage

### Here's an example of how to use the usegeoaddress hook in a React file:

```javascript
import React from "react";
import usegeoaddress from "usegeoaddress";

function App() {
  const { address, err, status } = usegeoaddress();

  if (err) {
    return <div>Error: {err.message}</div>;
  }

  if (status !== "granted") {
    return <div>Permission to access location was denied</div>;
  }

  if (!Address) {
    return <div>Loading...</div>;
  }

  return (
    <div>
      <h1>Address Details</h1>
      <p>Street: {address.street}</p>
      <p>City: {address.city}</p>
      <p>State: {address.state}</p>
      <p>Country: {address.country}</p>
    </div>
  );
}

export default App;
```

# Author

This usegeoaddress hook was developed by therohantomar. For any inquiries or feedback, please contact me at therohantomar@gmail.com.


Feel free to customize the readme file further based on your specific requirements or additional information you'd like to provide.
Member

The author's name should be mentioned as "therohantomar" and the email address as "therohantomar@gmail.com".

---
_Source: https://npm.io/package/usegeoaddress · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
