One thing formal state machines make difficult is component reuse. Let's say you have a music playback control component you wish to reuse across a feature rich player, as well as a mini playback controller. You COULD just use the full state machine to power the mini player, but most of the transitions would be unused. It would be unclear to the next maintainer which aspects were needed for each use case, thus making…
This was a nice thing in the example from Raganwald's blog post. The `transitionsTo` decorator: function transitionsTo (stateName, fn) { return function (...args) { const returnValue = fn.apply(this, args); this[STATE] = this[STATES][stateName]; return returnValue; }; } By separating the state transitions from the state actions in this way it allows the functional components to be reused much more easily. You can con…
I'd argue that you are building a separate state machine for the two players, but there is some reuse possible in this approach.