#92SensorsHard

useGeolocation

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)
// TODO: implement useGeolocation
function notImplemented(..._args: any[]): any {
  throw new Error('Not implemented');
}
export default notImplemented;
export const useGeolocation = notImplemented;

Open browser consoleTests