Skip to content

Commit

Permalink
fix: Add default location for static router
Browse files Browse the repository at this point in the history
Fixes #8243
  • Loading branch information
mjackson committed Nov 5, 2021
1 parent c6e9c06 commit e2b1609
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/api.md
Expand Up @@ -161,7 +161,7 @@ interface NativeRouterProps extends MemoryRouterProps {}
`<NativeRouter>` is the recommended interface for running React Router in a [React Native](https://reactnative.dev) app.

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

```tsx
import * as React from "react";
Expand Down Expand Up @@ -199,7 +199,7 @@ interface MemoryRouterProps {
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.

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

> **Tip:**
>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-router-dom/server.tsx
Expand Up @@ -15,7 +15,7 @@ export interface StaticRouterProps {
export function StaticRouter({
basename,
children,
location: locationProp
location: locationProp = "/"
}: StaticRouterProps) {
if (typeof locationProp === "string") {
locationProp = parsePath(locationProp);
Expand Down

0 comments on commit e2b1609

Please sign in to comment.