useHref
Resolves a full URL to be used as an href
to a link
. If a relative path is supplied, it will resolve to a full URL.
import { useHref } from "@remix-run/react";
function SomeComponent() {
const href = useHref();
return <a href={href}>Link</a>;
}
useHref(to, options)
to
Optional. The path to append to the resolved URL.
options
The only option is { relative: "route" | "path"}
, which defines the behavior when resolving relative URLs.
..
will remove one URL segment.