Skip to content

Files

Latest commit

f7e7133 Β· Apr 23, 2019

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)