Created
July 4, 2024 12:41
-
-
Save SandroMaglione/bbe1a6878f5fd92d6b87b59911c8550c to your computer and use it in GitHub Desktop.
VSCode snippet to scaffold the code for a generic state machine with `xstate`
This file contains hidden or 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
{ | |
"state machine": { | |
"prefix": "machine", | |
"description": "Create scaffold for state machine", | |
"body": [ | |
"import { setup } from \"xstate\";", | |
"", | |
"export const machine = setup({}).createMachine({", | |
" id: \"$0\",", | |
" initial: \"Idle\",", | |
" states: {", | |
" Idle: {},", | |
" },", | |
"});", | |
] | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment