// Available variables: // - Machine // - interpret // - assign // - send // - sendParent // - spawn // - raise // - actions // - XState (all XState exports) const postMachine = Machine({ id: 'post', initial: 'idle', context: { id: undefined, }, states: { idle: { on: { POST: 'posting' } }, posting: { on: { POST: { target: 'posted', actions: 'post' }, CANCEL: 'idle', } }, posted: { on: { EDIT: 'editing', DELETE: 'deleted', } }, editing: { on: { POST: { target: 'posted', actions: 'edit', }, CANCEL: 'posted', DELETE: 'deleted' } }, deleted: { on: { '': [{ target: 'idle', actions: 'delete' }] } } } });