Resolves a URL against the current Location
.
import { useHref } from "react-router";
function SomeComponent() {
let href = useHref("some/where");
// "/resolved/some/where"
}
function useHref(
to: To,
{
relative,
}: {
relative?: RelativeRoutingType;
} = ,
): string {}
The path to resolve
Defaults to "route"
so routing is relative to the route tree.
Set to "path"
to make relative routing operate against path segments.
The resolved href string