useHrefdeclare function useHref(
to: To,
options?: { relative?: RelativeRoutingType }
): string;
The useHref hook returns a URL that may be used to link to the given to location, even outside of React Router.
Tip:
You may be interested in taking a look at the source for the
<Link>component inreact-router-domto see how it usesuseHrefinternally to determine its ownhrefvalue.