# Finite state machines

Since watching the learn state machines with David K. Piano on YouTube, I have been intrigued about state machinces and the issues they help alleviate.

is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number of states at any given time.

So it the most common example, a form can move from an idle state to a loading state and a loading state to either a successful or error state. You shouldn’t get into an successful state without transitioning through the loading state. And more importantly, you shouldn’t be able to hit the submit button when not in the idle state or error state.

## Concepts

Formally, finite state machines have five parts:

- A finite number of states
- A finite number of events
- An initial state
- A transition function that determines the next state given the current state and event
- A (possibly empty) set of final states

via XState docs

## Resources

- XState - tool
- XState Visualizer - tool
- Robot - tool
- Learn State Machines - course
- Introduction to XState - screencast
- Let’s learn state machines with David K. Piano! - stream
- State Machines: What Are They? - article
- Reach UI Combobox stateChart - tool