react-use/docs/useGeolocation.md
2019-04-23 18:00:52 +03:00

442 B

useGeolocation

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

Usage

import {useGeolocation} from 'react-use';

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

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

Reference

useGeolocation(options: PositionOptions)