Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
- gatzjames
- gavriguy
- Geist5000
- gelove
- gesposito
- gianlucca
- gijo-varghese
Expand Down
5 changes: 4 additions & 1 deletion packages/react-router/lib/href.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ type ToArgs<T> =
Returns a resolved URL path for the specified route.

```tsx
const h = href("/:lang?", {})
// -> `/`

const h = href("/:lang?/about", { lang: "en" })
// -> `/en/about`

Expand Down Expand Up @@ -51,5 +54,5 @@ export function href<Path extends keyof Args>(
return value;
})
.filter((segment) => segment !== undefined)
.join("/");
.join("/") || "/";
}