react-ipgeolocation

1.4.0 • Public • Published

REACT-ipgeolocation 🌍

A react hook to get the country of a visitor from their IP address

Installation

Using npm:

npm install --save react-ipgeolocation

Using yarn:

yarn add react-ipgeolocation

Usage

import useGeoLocation from "react-ipgeolocation";
 
//somewhere in your app/component
const location = useGeoLocation();
console.log(location.country);

Implementation and privacy

This hook is a thin wrapper around the wonderful Country.is, a browser-friendly and privacy-conscious geolocation API that gets your users' country (and nothing else) from their IP.

Their hosted service does not log requests.

see also

react-hook-geolocation hook using the geolocation from the browser (the user's operating system will prompt the user to allow location access the first time it is requested)

/react-ipgeolocation/

    Package Sidebar

    Install

    npm i react-ipgeolocation

    Weekly Downloads

    1,326

    Version

    1.4.0

    License

    ISC

    Unpacked Size

    4.69 kB

    Total Files

    6

    Last publish

    Collaborators

    • tttp