Design a polling state machine with XState

preview_player
Показать описание
In this video I do a walkthrough of designing and implementing a state machine for polling an external service. When we use state machines and XState, we don't just get a code tool, we also get a design tool and thinking tool. State machines help us to think through and model problems in ways that other approaches fall short.

#XState #JavaScript #StateMachine #TypeScript
Рекомендации по теме
Комментарии
Автор

Really enjoyed this video, thank you very much! I would love to see more videos like this from you as YouTube is really lacking great Xstate videos.

It was nice to see you finding problems and working out solutions on the video, rather than having a completely pre-done solution you just copied and pasted in. Seeing your thought process as you fixed issues and charted the states out was very helpful.

ubxoqzb
Автор

You can add an onDone transition to the machine's active state that targets the inactive state. That fires once the substate 'active' reaches a state marked as final. Then you don't have to refresh the page, the machine resets for you.

MScottLassiter