Back to React Use

`useGeolocation`

docs/useGeolocation.md

17.6.0441 B
Original Source

useGeolocation

React sensor hook that tracks user's geographic location. This hook accepts position options.

Usage

jsx
import {useGeolocation} from 'react-use';

const Demo = () => {
  const state = useGeolocation();

  return (
    <pre>
      {JSON.stringify(state, null, 2)}
    </pre>
  );
};

Reference

ts
useGeolocation(options: PositionOptions)