Created
September 22, 2021 14:13
-
-
Save sebastiancarlsson/c34261d35f6c6dd3e83d1de9afd62d01 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const todoMachine = Machine({ | |
initial: 'pending', | |
context: { | |
description: 'This is my todo' | |
}, | |
states: { | |
pending: { | |
on: { | |
DONE: 'done', | |
SET_DESCRIPTION: { | |
actions: assign({ | |
description: (ctx, evt) => evt.text | |
}) | |
} | |
} | |
}, | |
done: { | |
on: { | |
UNDO: 'pending' | |
} | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment