React Corsair - v0.0.11
    Preparing search index...

    Function createRoute

    • Creates a route that is rendered in an Outlet of a Router.

      Type Parameters

      • Params extends Dict = {}

        Route params.

      • Data = void

        Data loaded by a route.

      • Context = any

        A router context.

      Parameters

      Returns Route<null, Params, Data, Context>

      const fooRoute = createRoute({ pathname: '/foo' });
      
    • Creates a route that is rendered in an Outlet of a parent route.

      Type Parameters

      • ParentRoute extends Route<any, any, any, any>

        A parent route.

      • Params extends Dict = {}

        Route params.

      • Data = void

        Data loaded by a route.

      Parameters

      Returns Route<ParentRoute, Params, Data, InferContext<ParentRoute>>

      const fooRoute = createRoute({ pathname: '/foo' });
      const barRoute = createRoute(fooRoute, { pathname: '/bar' });
    • Creates a route that is rendered in an Outlet of a Router.

      Type Parameters

      • Params extends Dict = {}

        Route params.

      Parameters

      • pathname: string

        A pathname pattern.

      • Optionalcomponent: ComponentType

        A component that is rendered by a route.

      Returns Route<null, Params, void>

      function Foo() {
      return 'Hello';
      }

      const fooRoute = createRoute('/foo', Foo);
    • Creates a route that is rendered in an Outlet of a parent route.

      Type Parameters

      • ParentRoute extends Route<any, any, any, any>

        A parent route.

      • Params extends Dict = {}

        Route params.

      Parameters

      • parentRoute: ParentRoute

        A parent route.

      • pathname: string

        A pathname pattern.

      • Optionalcomponent: ComponentType

        A component that is rendered by a route.

      Returns Route<ParentRoute, Params, void, InferContext<ParentRoute>>

      function Bar() {
      return 'Hello';
      }

      const fooRoute = createRoute('/foo');
      const barRoute = createRoute(fooRoute, '/bar', Bar);