Skip to content

Instantly share code, notes, and snippets.

@d4lek
Created March 22, 2021 10:24
Show Gist options
  • Select an option

  • Save d4lek/fec921d06bb115187ba7f8b532f8f935 to your computer and use it in GitHub Desktop.

Select an option

Save d4lek/fec921d06bb115187ba7f8b532f8f935 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const subscriptionMachine = Machine({
id: "subscription-payment-method",
initial: "preview",
context: {},
states: {
preview: {
on: {
ADD_FIRST_CARD: "add_first_card",
USE_DIFFERENT_CARD: "use_different_card",
UPDATE_EXISTING_CARD: "update_existing_card",
},
},
add_first_card: {
on: {
ADD_CARD: "preview",
},
},
use_different_card: {
on: {
USE_DIFFERENT: "preview",
},
},
update_existing_card: {
final: true
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment