dev
Branches
main (6.4.1)dev
Versions
6.4.1v4/5.xv3.x
useResolvedPath

useResolvedPath

Type declaration
declare function useResolvedPath(
  to: To,
  options?: { relative?: RelativeRoutingType }
): Path;

This hook resolves the pathname of the location in the given to value against the pathname of the current location.

This is useful when building links from relative values. For example, check out the source to <NavLink> which calls useResolvedPath internally to resolve the full pathname of the page being linked to.

See resolvePath for more information.

Docs and examples CC 4.0
Edit