0.1.2 • Published 4 years ago

use-geoip v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

useGeoIp: Get geolocation data on current user IP

All Contributors

Simple hook for fetching geolocation data based on users ip address.

🚀 Getting Started

Usage of the useGeoIp React hook

Simply use the hook from within your component.

import useGeoIp from 'useGeoIp';

Then you can destruct any of the available properties from the hooks return value (object). Please note that it will be undefined until result is presented thus regular nullcheck higher in the hierarchy might be in place.

const { country } = useGeoIp();

Available properties

  • businessName
  • businessWebsite
  • city
  • continent
  • country
  • countryCode
  • ipName
  • ipType
  • isp
  • lat
  • lon
  • org
  • query
  • region
  • status

All properties typed as strings.

0.1.2

4 years ago

0.1.1

4 years ago