diff --git a/contributors.yml b/contributors.yml index 329dfae023..9b8e51e886 100644 --- a/contributors.yml +++ b/contributors.yml @@ -115,6 +115,7 @@ - gatzjames - gavriguy - Geist5000 +- gelove - gesposito - gianlucca - gijo-varghese diff --git a/packages/react-router/lib/href.ts b/packages/react-router/lib/href.ts index 6f0523d1ef..0d93281dcf 100644 --- a/packages/react-router/lib/href.ts +++ b/packages/react-router/lib/href.ts @@ -23,6 +23,9 @@ type ToArgs = Returns a resolved URL path for the specified route. ```tsx + const h = href("/:lang?", {}) + // -> `/` + const h = href("/:lang?/about", { lang: "en" }) // -> `/en/about` @@ -51,5 +54,5 @@ export function href( return value; }) .filter((segment) => segment !== undefined) - .join("/"); + .join("/") || "/"; }