DEV Community

Discussion on: useState vs useReducer vs XState - Part 1: Modals

Collapse
 
likern profile image
Victor Malov

Thank you. Really interesting and amazing article. Exactly what I was looking for.

I would want to see auth flow. For me was the hardest part.
I have in mobile application:

  1. Onboarding screens
  2. On last screen I make a request to Firebase auth to sign in / up.
  3. Only if that was successful I initialize local database schema

After that onboarding screens can't be seen (user logged in).
When auth check to Firebase is made (when opening app) - while deciding is user logged in or not - user see splash screen.

I abstracted all of this into useAccount custom hook. But that was really hard and a lot of code.

Would be happy to see how this can look like with XState.