Primitives

useLocation

Edit this page

Retrieves reactive location object useful for getting things like pathname

const location = useLocation();
const pathname = createMemo(() => parsePath(location.pathname));
attributetypedescription
pathnamestringThe pathname part of the URL, without the query string.
searchstringThe query string part of the URL.
hashstringThe hash part of the URL, including the #.
stateanyCustom state passed from useNavigate
querystringReturns a store-like object containing all the query parameters of the URL.
Report an issue with this page