RoutesTestStubProps
react-router

RoutesTestStubProps interface

Properties

future

Type: Partial<FutureConfig>

Future flags mimicking the settings in remix.config.js

hydrationData

Type: Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>

Used to set the route's initial loader and action data. e.g. hydrationData={{ loaderData: { "/contact": { locale: "en-US" } }, actionData: { "/login": { errors: { email: "invalid email" } }} }}

initialEntries

Type: InitialEntry[]

The initial entries in the history stack. This allows you to start a test with multiple locations already in the history stack (for testing a back navigation, etc.) The test will default to the last entry in initialEntries if no initialIndex is provided. e.g. initialEntries={["/home", "/about", "/contact"]}

initialIndex

Type: number

The initial index in the history stack to render. This allows you to start a test at a specific entry. It defaults to the last entry in initialEntries. e.g. initialEntries: ["/", "/events/123"] initialIndex: 1 // start at "/events/123"

Docs and examples CC 4.0