Check out our new docs!
🆕 Find more about effects and actions in XState (opens new window) in our new docs.
In statecharts, "side-effects" can be grouped into two categories:
"Fire-and-forget" effects, which execute a synchronous side-effect with no events sent back to the statechart, or send an event synchronously back to the statechart:
- Actions - single, discrete effects
- Activities - continuous effects that are disposed when the state they were started in is exited
Invoked effects, which execute a side-effect that can send and receive events asynchronously:
- Invoked Promises - single, discrete effects over time that may
rejectonce, which are sent as events to the parent machine
- Invoked Callbacks - continuous effects over time that may send multiple events, as well as listen for events sent directly to it, to/from the parent machine
- Invoked Observables - continuous effects over time that may send multiple events triggered by messages from the observed stream
- Invoked Machines - continuous effects represented by
Machineinstances that can send/receive events, but also notify the parent machine when it has reached its final state
← Final states Actions →