Hacker News new | ask | show | jobs
by designed 1401 days ago
I would use a state machine in this case. The best tool for doing this in JavaScript/TypeScript is XState. Highly recommend.