Thursday, 1 November, 2018 UTC


A state machine is a standardized way of defining and enumerating all possible (hence "finite") states of a system. It also defines and enumerates the transitions from one state to another. These transitions are triggered by sending events to our machine. Simply put, it is possibly the most robust way to define and manage state in an application. In this lesson, we'll build a basic elevator state machine. An elevator has three possible states: stopped, moving up, or moving down. We'll define these states, their transitions, and send events to change our state. We'll also cover using `xstate` machines in strict mode, as well as adding a `key` property to make our error messages better.