This is React Hook to find your current position, when you use Navigator Geolocation.
npm i @jnooks/use-navigation
yarn add @jnooks/use-navigation
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 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 |