Skip to content

Type Alias: RouteDataResolver

API / @xmachines/play-xstate / with-routing / RouteDataResolver

type RouteDataResolver = (args) => RouteData;

Defined in: packages/play-router/src/types.ts:28

The function form of RouteObject.data.

The signature mirrors WithDynamicParams of XState: the resolver reads the context of the machine and the event that asks for the route, and it returns the data.

The resolver reads every field of the event, and event.data among them: that field carries what the SENDER of the event supplied, and the resolver decides how it combines with what the state declares. The data that the resolver RETURNS goes to context.data, and it does not go back onto the event.

Parameters

ParameterType
args{ context: unknown; event: PlayRouteEvent; }
args.contextunknown
args.eventPlayRouteEvent

Returns

RouteData