@ziphooks/use-geolocation

1.0.0 • Public • Published

@ziphooks/use-geolocation

React Hook for get geolocation about client.

Installation

yarn

yarn add @ziphooks/use-geolocation

npm

npm i @ziphooks/use-geolocation

Usage

import React from "react";
import useGeolocation from "@ziphooks/use-geolocation";

function App() {
  const { lat, lon, reload } = useGeolocation();
  return (
    <>
      <h1>latitude: {lat}</h1>
      <h1>longitude: {lon}</h1>
      <button onClick={reload}>Reload</button>
    </>
  );
};

Return

Return value Type Description
lat Number A number latitude of current geolocation
lon Number A number longitude of current geolocation
reload Function A function to reload geolocation

Readme

Keywords

Package Sidebar

Install

npm i @ziphooks/use-geolocation

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

2.02 kB

Total Files

4

Last publish

Collaborators

  • zipperdev