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