mjstahl/use-state-machine

2.0 Refactor of APIs

Closed this issue · 1 comments

to and via need to be combined into a single property. We want to be able to display the name of a state we can transition to, as well as transition to that state. Right now, Stated.__transition requires the name of an action, it should take a state instead.

We should separate the FSM needed by this project, and the @mjstahl/stated project. This project does not need guards, or onLeave and onEnter events. In fact, I believe their use would be contradictory in how the react developers recommend the structures of apps and state. This project should contain its own stripped down version of an FSM.

The second argument to the constructor should be an object with (currently) one property, persistent: Boolean. There may be other options we want to add, so we might as well make the change while we are changing other APIs