top | item 35942393

(no title)

aarpmcgee | 2 years ago

All I know is, the parts of my app that I implemented with state machines are by far the most stable, least buggy.

fwiw, if xstate feels like too much for whatever reason, https://thisrobot.life has seemed like a decent alternative to me.

discuss

order

hashbig|2 years ago

Same here, state machines are fantastic to extend state driven UIs without worrying about breaking existing behavior. If you find XState too verbose consider using a DSL that compiles down to JS like Lucy: https://lucylang.org

simlevesque|2 years ago

It seems like both of your links are projects from the same person, he must be passionated about state machines.

psnehanshu|2 years ago

Looks like Lucy compiles down to XState.

nailer|2 years ago

You could also just make a very simple State machine. They don’t take a huge amount of code. you have a variable with the current state, you have a function that takes the previous state and the new State as arguments, now implement whatever logic you need. Not everything needs a library.

Pardon the unnecessary caps, I am using voice dictation.

chombier|2 years ago

When I need something lightweight I usually implement state machines using generators/coroutines when the language provides them, as they compose well and I find it easier to follow to control flow anyways.