npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bigdatacloudapi/react-reverse-geocode-client

v1.1.2

Published

React hook for free reverse geocoding — get city, country, and locality from GPS coordinates with automatic IP geolocation fallback. No API key needed.

Readme

@bigdatacloudapi/react-reverse-geocode-client

React hook for free reverse geocoding — detect your user's city, country, and locality from GPS coordinates with automatic IP geolocation fallback. No API key needed.

Powered by BigDataCloud's free client-side reverse geocoding API.

Install

npm install @bigdatacloudapi/react-reverse-geocode-client

Quick Start

import { useGeoLocation } from '@bigdatacloudapi/react-reverse-geocode-client';

function App() {
  const { data, loading, error, source } = useGeoLocation();

  if (loading) return <p>Detecting location...</p>;
  if (error) return <p>Error: {error}</p>;

  return (
    <div>
      <h1>📍 {data?.city}, {data?.countryName}</h1>
      <p>Region: {data?.principalSubdivision}</p>
      <p>Postcode: {data?.postcode}</p>
      <p>Detected via: {source}</p>
    </div>
  );
}

That's it. No API key, no account, no configuration.

Note: useLocation is also available as an alias for backward compatibility.

How It Works

  1. GPS first — requests the browser's geolocation (user sees a permission prompt)
  2. IP fallback — if GPS is denied or unavailable, automatically falls back to IP geolocation
  3. Same response — identical JSON structure regardless of detection method

The response includes city, country, region, postcode, timezone, and detailed administrative/informative locality data in 100+ languages.

API

useGeoLocation(options?)

React hook that detects the user's location on mount.

const { data, loading, error, source, refresh } = useLocation({
  language: 'en',           // Locality language (ISO 639-1). Default: 'en'
  manual: false,            // Don't fetch on mount. Default: false
  timeout: 10000,           // GPS timeout in ms. Default: 10000
});

Returns:

| Field | Type | Description | |-------|------|-------------| | data | LocationData \| null | Location data (see below) | | loading | boolean | True while detecting | | error | string \| null | Error message if failed | | source | 'gps' \| 'ip' \| null | How location was determined | | refresh | () => void | Manually trigger a new detection |

Response Data

{
  latitude: number;
  longitude: number;
  lookupSource: 'coordinates' | 'ipGeolocation';
  continent: string;
  continentCode: string;
  countryName: string;
  countryCode: string;
  principalSubdivision: string;      // State/province
  principalSubdivisionCode: string;  // e.g. "US-CA"
  city: string;
  locality: string;                  // Neighbourhood/suburb
  postcode: string;
  plusCode: string;                   // Google Plus Code
  localityInfo: {
    administrative: [...],           // Country → state → city hierarchy
    informative: [...]               // Continent, timezone, etc.
  }
}

Examples

Multi-language

// Get location names in Japanese
const { data } = useGeoLocation({ language: 'ja' });
// data.countryName → "日本"
// data.city → "東京"

Manual Trigger

function SearchButton() {
  const { data, loading, refresh } = useGeoLocation({ manual: true });

  return (
    <button onClick={refresh} disabled={loading}>
      {loading ? 'Detecting...' : 'Detect My Location'}
    </button>
  );
}

Next.js / SSR

The hook is client-side only — it checks for navigator before accessing geolocation. For SSR frameworks, use it in client components:

'use client';
import { useGeoLocation } from '@bigdatacloudapi/react-reverse-geocode-client';

Why BigDataCloud?

  • Free forever — no API key, no account, no credit card
  • Privacy-first — anonymous, no user tracking, GDPR compliant
  • GPS + IP fallback — one hook handles both seamlessly
  • 100+ languages — locality names in any language
  • Fast — sub-millisecond response times, global CDN
  • Accurate — powered by patented IP geolocation technology

Fair Use

This hook uses BigDataCloud's free client-side API, which is for client-side use only (browser/mobile). For server-side or testing, use the server-side API with a free API key. See the fair use policy.

Need More?

License

MIT