React Router API Reference
    Preparing search index...

    Function createRoutesStub

    • Creates a React component that renders the provided routes in a test-friendly React Router context.

      Use this to unit test components that rely on router context, such as loaderData, actionData, and route matches.

      Parameters

      • routes: StubRouteObject[]

        The route objects to render in the test router.

      • Optional_context: RouterContextProvider

        An optional RouterContextProvider for supplying application context values to route middleware, loaders, and actions.

      Returns (__namedParameters: RoutesTestStubProps) => Element

      A React component that renders the test router.

      framework

      data