Skip to content

Action

Action = ["action/save", string[], any] | ["action/toggle", string[]] | ["action/increment", string[], number?] | ["action/decrement", string[], number?] | ["action/push", string[], any] | ["action/remove", string[], any] | ["action/delete", string[]] | ["action/merge", string[], Record<string, any>] | ["action/reset", string[]?] | ["action/batch", Action[]] | ["action/event", EventAction] | ["action/async", string, string, (AsyncConcurrencyStrategy | AsyncOptions)?, ...any[]] | ["action/async-prevent", string, string, ...any[]] | ["action/async-cancel", string, string, ...any[]] | ["action/async-queue", string, string, ...any[]] | ["action/async-debounce", string, string, number?, ...any[]] | ["machine/transition", string, string, ...Action[]] | ["machine/transition-if", string, string, Action[], Action[]] | ["machine/force", string, string, ...Action[]] | ["machine/sequence", string, object[]] | ["machine/retry", string, string, number, Action[]] | ["machine/delay", string, string, number, Action[]]

Defined in: types.ts:84

A state change as data. Every hook, binding and adapter takes these tuples.

  • action/* (sync): save, toggle, increment, decrement, push, remove, delete, merge, reset and batch take a path into state.
  • action/event: call preventDefault or stopPropagation.
  • action/async*: run a named async handler under an operation id, with a AsyncConcurrencyStrategy.
  • machine/*: change a machine’s mode (transition, transition-if, force, sequence, retry, delay).

The helpers (save, push, asyncAction, …) build the same tuples. Each variant’s arguments are described on the action types page.