Back to React Router

StaticRouter

docs/api/declarative-routers/StaticRouter.md

7.6.21.2 KB
Original Source

StaticRouter

<!-- ⚠️ ⚠️ IMPORTANT ⚠️ ⚠️ Thank you for helping improve our documentation! This file is auto-generated from the JSDoc comments in the source code, so please edit the JSDoc comments in the file below and this file will be re-generated once those changes are merged. https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/dom/server.tsx -->

[MODES: declarative]

Summary

Reference Documentation ↗

A <Router> that may not navigate to any other Location. This is useful on the server where there is no stateful UI.

Signature

tsx
function StaticRouter({
  basename,
  children,
  location: locationProp = "/",
}: StaticRouterProps)

Props

basename

The base URL for the static router (default: /)

children

The child elements to render inside the static router

location

The Location to render the static router at (default: /)