1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Add Actions to Transitions to Fire Side Effects

    xstateXState
    >=4.6.7

    Actions are "fire-and-forget" side effects that are triggered by transitions. We set functions on a transition object's actions property to have them called when a transition is taken.

    javascript//...
    EVENT_NAME: {
      target: 'name-of-state-to-transition-to',
      actions: [(context, event) => { sideEffectToFire(context, event) }]
    }
    //...