#59SensorsMedium

useLocation

useLocation

React sensor hook that tracks brower's location.

For Internet Explorer you need to install a polyfill.

Usage

import {useLocation} from 'react-use';

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

  return (
    <pre>
      {JSON.stringify(state, null, 2)}
    </pre>
  );
};
// TODO: implement useLocation
function notImplemented(..._args: any[]): any {
  throw new Error('Not implemented');
}
export default notImplemented;
export const useLocation = notImplemented;

Open browser consoleTests