3 ms·
It’s a big boon to the development of tiny simple UIs! I use XState to manage my login state. Not logged in, trying, logged in, log in failed, trying log out,
by jen729w 6y ago
It’s a big boon to the development of tiny simple UIs!
I use XState to manage my login state. Not logged in, trying, logged in, log in failed, trying log out, logged out.
The thing I love is the confidence the machine gives me. Unless I’ve buggered up completely, it basically can’t be wrong. That’s incredibly reassuring.
Thanks for XState and all the work you put in to it. It’s an amazing thing.
- adamkl 6y agoFunny you mentioned login state. I've used it for the exact same thing. I had a "userService" machine (embedded in a React UI) that handled all the legwork of an OAuth2 flow and ended with the user in an "authenticated" state with their details as part of the machine context (for use in any other part of the app via a custom hook). You are absolutely right, it couldn't be wrong. It always just worked exactly the way it was supposed to. I'm now working on a project that handles logins via a set of disconnected boolean flags flowing through redux and it is a mess.