Skip to content

tiaanduplessis/use-geolocation-position

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

use-geolocation-position

package version package downloads standard-readme compliant package license make a pull request

React hook for geolocation.getCurrentPosition and getCurrentPosition.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

  1. Fork it and create your feature branch: git checkout -b my-new-feature
  2. Commit your changes: git commit -am "Add some feature"
  3. Push to the branch: git push origin my-new-feature
  4. Submit a pull request

License

MIT

About

React hook for geolocation.getCurrentPosition and geolocation.watchPosition

Resources

License

Stars

Watchers

Forks

Packages

No packages published