Skip to content

Files

Latest commit

 

History

History
25 lines (18 loc) Β· 442 Bytes

useGeolocation.md

File metadata and controls

25 lines (18 loc) Β· 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)