Skip to content

Instantly share code, notes, and snippets.

@tomraithel
Last active February 27, 2020 06:36
Show Gist options
  • Save tomraithel/86cb88241f45655d82b8afa4b99e8bf4 to your computer and use it in GitHub Desktop.
Save tomraithel/86cb88241f45655d82b8afa4b99e8bf4 to your computer and use it in GitHub Desktop.
FlightSelection xState config
const wizardStates = {
initial: "date",
states: {
date: {
on: {
NEXT: "flight"
}
},
flight: {
on: {
NEXT: {target: "loading", actions: "placeOrder"},
EDIT_DATE: "date"
}
},
loading: {
on: {
PLACE_ORDER_ERROR: "flight",
PLACE_ORDER_SUCCESS: "#flightSelection.success"
}
}
}
};
const flightSelectionMachine = Machine({
key: "flightSelection",
initial: "wizard",
states: {
wizard: {
...wizardStates
},
success: {
final: true
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment