Function: withView()
API / @xmachines/play-xstate / with-view / withView
function withView<TMachine>(Base): PlayerConstructor<TMachine, Viewable>;Defined in: packages/play-xstate/src/with-view.ts:98
Adds the view capability to an actor class.
Compose it AFTER the routing capability. An override calls super.onSnapshot() first,
so compose(PlayerActor, withRouting, withView) gives the route its new value before
the view derives from the same transition. A router bridge therefore sees a guard
redirect before a renderer sees the view of the state that the guard refused.
Type Parameters
| Type Parameter |
|---|
TMachine extends AnyStateMachine |
Parameters
| Parameter | Type | Description |
|---|---|---|
Base | PlayerConstructor<TMachine> | The actor class to extend, normally PlayerActor or the result of another capability. |
Returns
PlayerConstructor<TMachine, Viewable>