React Router API Reference
    Preparing search index...

    Function useHref

    • Resolves a URL against the current Location.

      Parameters

      • to: To

        The path to resolve

      • options: { relative?: RelativeRoutingType } = {}

        Options

        • Optionalrelative?: RelativeRoutingType

          Defaults to "route" so routing is relative to the route tree. Set to "path" to make relative routing operate against path segments.

      Returns string

      The resolved href string

      import { useHref } from "react-router";

      function SomeComponent() {
      let href = useHref("some/where");
      // "/resolved/some/where"
      }

      @public