3 ms·
IMO, state machines are becoming a "big deal" because front-end developers are finally realizing that there is a name (and strict formalism) for the patterns th
by davidkpiano 8y ago
IMO, state machines are becoming a "big deal" because front-end developers are finally realizing that there is a name (and strict formalism) for the patterns that they've been using to manage complex UI behavior. Not only is this standardized (SCXML), it's been heavily researched for the last 30+ years and has numerous applications in many different areas of tech.
I'm working on articles for using XState in various frameworks, such as React, Vue, Angular, etc. It's already being used in production in places like vaultproject.io, tipe.io, serviceworkies.com, and more.
You can use the interpreter or create your own. An XState machine instance has a pure .transition() method that takes the current state and event, and returns the next state (+ actions, etc.). This can be used anywhere you would determine the next state of your application (or any of your app's constituent parts).
- Kagerjay 8y agoWould xstate potentially eliminate the need for redux for state management in react? If so, how would the implementation differ from store and reducers?
- acemarke 8y agoI'm a Redux maintainer. You could probably use xstate instead of Redux in some cases. You could also probably use xstate as the actual implementation of your Redux reducers, too :)
- nikisweeting 8y agoI could see them being used together with something like https://github.com/Monadical-SAS/redux-time https://github.com/Monadical-SAS/redux-time to manage animated transitions of game states or data visualizations from one step to the next.
- christophilus 8y agoMeh. I’m mostly a frontender today. I learned about state machines in uny 20 years ago. I wrote a sophisticated state machine in C# 15 years ago (a back end) that drove all logic for everything happening from highway to the stacks at a major shipping terminal. Assuming that frontenders are only “just discovering” anything is quite an assumption, and comes off as ignorant and condescending.
- davidkpiano 8y agoSorry for coming off as ignorant/condescending, it was definitely not my intention. But to be fair, I asked this question a year ago and the majority of front-end developers were unfamiliar with state machines: https://twitter.com/DavidKPiano/status/880878305502785539 https://twitter.com/DavidKPiano/status/880878305502785539 I'm glad you're not, but that's not representative of the community.