Skip to content
Version: xstate@5.0.0

StateNodeConfig interface​

Signature:

export interface StateNodeConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TTag extends string, TOutput> 

Properties​

PropertyModifiersTypeDescription
after?DelayedTransitions<TContext, TEvent, TActor, TAction, TGuard, TDelay>(Optional) The mapping (or array) of delays (in milliseconds) to their potential transition(s). The delayed transitions are taken after the specified delay in an interpreter.
always?TransitionConfigOrTarget<TContext, TEvent, TEvent, TActor, TAction, TGuard, TDelay>(Optional) An eventless transition that is always taken when this state node is active.
description?string(Optional) A text description of the state node
entry?Actions<TContext, TEvent, TEvent, undefined, TActor, TAction, TGuard, TDelay>(Optional) The action(s) to be executed upon entering the state node.
exit?Actions<TContext, TEvent, TEvent, undefined, TActor, TAction, TGuard, TDelay>(Optional) The action(s) to be executed upon exiting the state node.
history?'shallow' | 'deep' | boolean | undefined(Optional) Indicates whether the state node is a history state node, and what type of history: shallow, deep, true (shallow), false (none), undefined (none)
id?string | undefined(Optional) The unique ID of the state node, which can be referenced as a transition target via the #id syntax.
initial?InitialTransitionConfig<TContext, TEvent, TActor, TAction, TGuard, TDelay> | string | undefined(Optional) The initial state transition.
invoke?SingleOrArray<InvokeConfig<TContext, TEvent, TActor, TAction, TGuard, TDelay>>(Optional) The services to invoke upon entering this state node. These services will be stopped upon exiting this state node.
meta?any(Optional) The meta data associated with this state node, which will be returned in State instances.
on?TransitionsConfig<TContext, TEvent, TActor, TAction, TGuard, TDelay>(Optional) The mapping of event types to their potential transition(s).
onDone?string | SingleOrArray<TransitionConfig<TContext, DoneStateEvent, TEvent, TActor, TAction, TGuard, TDelay>> | undefined

(Optional) The potential transition(s) to be taken upon reaching a final child state node.

This is equivalent to defining a [done(id)] transition on this state node's on property.

order?number(Optional) The order this state node appears. Corresponds to the implicit document order.
output?Mapper<TContext, TEvent, unknown, TEvent> | NonReducibleUnknown

(Optional) The output data sent with the "xstate.done.state._id_" event if this is a final state node.

The output data will be evaluated with the current context and placed on the .data property of the event.

parent?StateNode<TContext, TEvent>(Optional)
states?StatesConfig<TContext, TEvent, TActor, TAction, TGuard, TDelay, TTag, NonReducibleUnknown> | undefined(Optional) The mapping of state node keys to their state node configurations (recursive).
tags?SingleOrArray<TTag>(Optional) The tags for this state node, which are accumulated into the state.tags property.
target?string(Optional) A default target for a history state
type?'atomic' | 'compound' | 'parallel' | 'final' | 'history'

(Optional) The type of this state node:

- 'atomic' - no child state nodes - 'compound' - nested child state nodes (XOR) - 'parallel' - orthogonal nested child state nodes (AND) - 'history' - history state node - 'final' - final state node