MachineView
Defined in: core/machineView.ts:18
A machine’s state and transition checks, as returned by useStateMachine,
useMachines and useLocalActions().getMachine.
The fields describe the render: they’re what the component shows. The methods check against the latest state when called, so an event handler asks the same question the transition it’s about to dispatch will.
Properties
Section titled “Properties”| Property | Type | Description | Defined in |
|---|---|---|---|
allowedTransitions | string[] | Modes the current mode declares it can move to (invariants not checked). | core/machineView.ts:24 |
currentMode | string | The current mode, or the definition’s initialState before the first transition. | core/machineView.ts:20 |
error | string | undefined | The last rejected transition’s message; cleared by the next successful one. | core/machineView.ts:22 |
Methods
Section titled “Methods”canTransitionTo()
Section titled “canTransitionTo()”canTransitionTo(
targetMode):boolean
Defined in: core/machineView.ts:26
Whether a transition to targetMode would be accepted right now.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
targetMode | string |
Returns
Section titled “Returns”boolean
validateTransition()
Section titled “validateTransition()”validateTransition(
targetMode):TransitionResult
Defined in: core/machineView.ts:28
The full result a transition to targetMode would have right now.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
targetMode | string |