statechart-calculator icon indicating copy to clipboard operation
statechart-calculator copied to clipboard

Move calculation and state handling into machine

Open pke opened this issue 4 years ago • 4 comments

Thanks for writing this example statechart for xState. I am currently putting together an API Server for xState charts and would like to include your calculator as an example. For that to work, the machine itself must be self contained. That means it should be usable without external dependencies.

In your example here you do the state management and calculations in the react component. Would it be possible to separate the two concerns: state and UI a bit more? It would make the react component leaner and I could just include your machine.js in my API server.

What do you think?

pke avatar Nov 25 '19 09:11 pke