Skip to content

Instantly share code, notes, and snippets.

@tsawan
Last active June 1, 2020 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsawan/d720892ea5f9f3b0a56de27f3c5c9991 to your computer and use it in GitHub Desktop.
Save tsawan/d720892ea5f9f3b0a56de27f3c5c9991 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
/*const ss = Machine({
id: 'hola',
initial: 'na',
states: {
na: {
on: {
ACT: 'action'
}
},
action: {}
}
})
*/
const curdMachine = Machine({
id: 'crud',
initial: 'idle',
states: {
idle: {
on: {
ADD: 'add',
SELECT: 'view'
}
},
view: {
on: {
ADD: 'add',
EDIT: 'edit',
DELETE: 'remove'
}
},
add: {
on: {
SAVE: 'idle',
CANCEL: 'idle'
}
},
edit: {
on: {
SAVE: 'view',
CANCEL: 'view'
}
},
remove: {
on: {
SAVE: 'idle',
CANCEL: 'view'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment