@jnooks/use-navigation

1.0.1 • Public • Published

@jnooks/use-navigation

This is React Hook to find your current position, when you use Navigator Geolocation.

Installation

npm

npm i @jnooks/use-navigation

yarn

yarn add @jnooks/use-navigation

Usage

import useNavigation from "@jnooks/use-navigation"

const App = () => {
  const {latitude,longitude} = useNavigation();
  return (
    <div>
      <h1>Hello</h1>
      <a href={`https://www.openstreetmap.org/#map=18/${latitude}/${longitude}`} target="_blank" rel="noopener noreferrer" >Open Map</a>
    </div>
  );
};

Return

Return value Type Description Default value
latitude number It is the latitude to use on your REST API URL true
longitude number It is the longitude to use on your REST API URL true

Reference

Using the Geolocation API

Package Sidebar

Install

npm i @jnooks/use-navigation

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

2.26 kB

Total Files

4

Last publish

Collaborators

  • jigeum