1.0.1 • Published 1 year ago

@jnooks/use-navigation v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@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 valueTypeDescriptionDefault value
latitudenumberIt is the latitude to use on your REST API URLtrue
longitudenumberIt is the longitude to use on your REST API URLtrue

Reference

Using the Geolocation API

1.0.1

1 year ago

1.0.0

1 year ago