Skip to content

Commit e2b1609

Browse files
committed
fix: Add default location for static router
Fixes #8243
1 parent c6e9c06 commit e2b1609

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ interface NativeRouterProps extends MemoryRouterProps {}
161161
`<NativeRouter>` is the recommended interface for running React Router in a [React Native](https://reactnative.dev) app.
162162

163163
- `<NativeRouter initialEntries>` defaults to `["/"]` (a single entry at the root `/` URL)
164-
- `<NativeRouter initialIndex>` defaults to the last index of `props.initialEntries`
164+
- `<NativeRouter initialIndex>` defaults to the last index of `initialEntries`
165165

166166
```tsx
167167
import * as React from "react";
@@ -199,7 +199,7 @@ interface MemoryRouterProps {
199199
A `<MemoryRouter>` stores its locations internally in an array. Unlike `<BrowserHistory>` and `<HashHistory>`, it isn't tied to an external source, like the history stack in a browser. This makes it ideal for scenarios where you need complete control over the history stack, like testing.
200200

201201
- `<MemoryRouter initialEntries>` defaults to `["/"]` (a single entry at the root `/` URL)
202-
- `<MemoryRouter initialIndex>` defaults to the last index of `props.initialEntries`
202+
- `<MemoryRouter initialIndex>` defaults to the last index of `initialEntries`
203203

204204
> **Tip:**
205205
>

packages/react-router-dom/server.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface StaticRouterProps {
1515
export function StaticRouter({
1616
basename,
1717
children,
18-
location: locationProp
18+
location: locationProp = "/"
1919
}: StaticRouterProps) {
2020
if (typeof locationProp === "string") {
2121
locationProp = parsePath(locationProp);

0 commit comments

Comments
 (0)