react-code-dataset / react-use /docs /useGeolocation.md
Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
|
raw
history blame
442 Bytes

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)