Skip to content

Interface: PlayActor

API / @xmachines/play-tanstack-react-router / PlayActor

Defined in: play-router/src/types.ts:312

The complete actor shape of the PlayRouterProvider component of each framework adapter: play-solid-router, play-vue-router, play-react-router, and each adapter on the shared framework router bridge bases.

The shape extends RoutableActor with currentView, because the provider renders the current view spec and also keeps the routes in step. It therefore needs both capabilities.

  • Use RoutableActor when you need the routing alone, for example in a RouterBridgeBase subclass, or in connectRouter.
  • Use PlayActor when the component also renders the current view spec, for example for the renderer callback parameter of PlayRouterProvider, and in PlayRenderer.

Every AbstractActor subclass that implements both Routable and Viewable satisfies this interface structurally.

Example

import type { PlayActor } from "@xmachines/play-router";
function MyRouterProvider({ actor }: { actor: PlayActor }) {
// it reads actor.currentRoute for the routing, and actor.currentView for the render
}

Extends

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
currentRoutereadonlyComputed<string | null>The TC39 Signal of the current URL path of the actor, or of its state ID.RoutableActor.currentRouteplay-router/src/types.ts:274
currentViewreadonlyState<PlaySpec | null>The TC39 Signal of the current view spec of the actor, or null when no view is active.-play-router/src/types.ts:314
initialRoutereadonlystring | nullThe route of the initial state of the machine. The constructor fixes it. A router bridge compares it with the browser URL. It therefore separates a deep link, where the router wins, from a restore of a session, where the actor wins.RoutableActor.initialRouteplay-router/src/types.ts:280

Methods

send()

send(event): void;

Defined in: play-router/src/types.ts:282

Sends a route navigation event to the actor.

Parameters

ParameterType
eventPlayRouteEvent

Returns

void

Inherited from

RoutableActor.send