Skip to content

Types: Route<TName, TUrl, TMeta, TState, TMatches, TContext>

ts
type Route<TName, TUrl, TMeta, TState, TMatches, TContext> = TUrl & object;

Represents the structure of a route within the application. Return value of createRoute

Type Declaration

context

ts
context: TContext;

Related routes and rejections for the route. The context is exposed to the hooks and props callback functions for this route.

depth

ts
depth: number;

Internal

A value that represents how many parents a route has. Used for route matching

hooks

ts
hooks: Hooks[];

Internal

The stores for routes including ancestors. Order of routes will be from greatest ancestor to narrowest matched.

id

ts
id: string;

Unique identifier for the route, generated by router.

matched

ts
matched: LastInArray<TMatches, CreatedRouteOptions>;

The specific route properties that were matched in the current route.

matches

ts
matches: TMatches;

The specific route properties that were matched in the current route, including any ancestors. Order of routes will be from greatest ancestor to narrowest matched.

meta

ts
meta: TMeta;

Represents additional metadata associated with a route, combined with any parents.

name

ts
name: TName;

Identifier for the route as defined by user. Name must be unique among named routes. Name is used for routing and for matching.

prefetch?

ts
optional prefetch: PrefetchConfig;

Determines what assets are prefetched when router-link is rendered for this route. Overrides router level prefetch.

state

ts
state: TState;

Represents the schema of the route state, combined with any parents.

Type Parameters

Type ParameterDefault typeDescription
TName extends stringstringRepresents the unique name identifying the route, typically a string.
TUrl extends UrlUrl-
TMeta extends RouteMetaRouteMeta-
TState extends Record<string, Param>Record<string, Param>-
TMatches extends CreatedRouteOptions[]CreatedRouteOptions[]-
TContext extends RouteContext[]RouteContext[]-

Template

The type or structure of the route's path.

Template

The type or structure of the query parameters associated with the route.