Last active
February 27, 2020 06:36
-
-
Save tomraithel/86cb88241f45655d82b8afa4b99e8bf4 to your computer and use it in GitHub Desktop.
FlightSelection xState config
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 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