Socket
Socket
Sign inDemoInstall

react-ip-location

Package Overview
Dependencies
10
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-ip-location

Get your ip address and location with a single line of code, get location of a provided ip address


Version published
Maintainers
1
Install size
22.8 MB
Created

Readme

Source

react-ip-location

  • Simplest, lightest and fastest JS library to get your ip address and location.

  • Check current location by a provided ip address.

NPM JavaScript Style Guide

Table of Contents

Features

  • getIPLocation();
  • checkIPLocation('your-ip-address');
  • Supports the Promise

Browser Support

ChromeFirefoxSafariOperaEdgeIE
Latest ✔Latest ✔Latest ✔Latest ✔Latest ✔11 ✔

Installing

Package manager

Using yarn:

$ yarn add react-ip-location

Using npm:

$ npm install react-ip-location

Usage

import React from 'react';
import { getIPLocation, checkIPLocation } from 'react-ip-location';


export const App = () => {
  getIPLocation().then(result => {
    // console.log(result);
  });
  checkIPLocation('42.115.92.231').then(result => {
    // console.log(result);
  });

  // Or declare an async function in your component
  const getMyIP = async () => {
      const location = await getIPLocation();
      return console.log("my location", location);
  };
  
  getMyIP();

  return <div>PAGE COTNENT</div>

};

License

MIT © HFrontend


Keywords

FAQs

Last updated on 17 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc