README
use-path
import {useLocation, usePath, navigate} from 'use-location';
// in react component
useLocation(); // /users/1
usePath(); // ['users', '1']
// anywhere
navigate('/about'); // changes location and notifies hooks
Minimal React navigation
<script type="module">
import usePath from 'https://cdn.skypack.dev/use-path';
</script>
import {useLocation, usePath, navigate} from 'use-location';
// in react component
useLocation(); // /users/1
usePath(); // ['users', '1']
// anywhere
navigate('/about'); // changes location and notifies hooks