1.0.1 • Published 3 years ago
use-geolocation-position v1.0.1
use-geolocation-position
React hook for
geolocation.getCurrentPosition
andgetCurrentPosition.watchPosition
Table of Contents
Usage
import React from 'react'
import { useCurrentPosition, useWatchPosition } from 'use-geolocation-position'
export default function App () {
const currentPosition = useCurrentPosition({
// Default config
maximumAge: Infinity,
timeout: 0,
enableHighAccuracy: true
})
const watchedPosition = useWatchPosition({
// Default config
maximumAge: Infinity,
timeout: 0,
enableHighAccuracy: true
})
return (
<div className='App'>
<p>{JSON.stringify(currentPosition, null, 2)}</p>
<p>{JSON.stringify(watchedPosition, null, 2)}</p>
</div>
)
}
Install
This project uses node and npm.
$ npm install use-geolocation-position
$ # OR
$ yarn add use-geolocation-position
Contribute
- Fork it and create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am "Add some feature"
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
License
MIT