Docs
useLocation
Returns the current location object.
import { useLocation } from "@remix-run/react";
function SomeComponent() {
const location = useLocation();
// ...
}
#Properties
#location.hash
The hash of the current URL.
#location.key
The unique key of this location.
#location.pathname
The path of the current URL.
#location.search
The query string of the current URL.
#location.state
The state value of the location created by <Link state>
or navigate
.