// get the current phone number that a user has typed
// also, a boolean telling you if the # is a valid number
// 🚨isValidPhoneNumber does NOT mean the the user has confirmed
// their number. It only means the phoneNumber is a valid phone.
This can be useful if you're building your own UI from scratch, and you don't want to have to worry about updating the state of the user's phone number, whether or not it's valid, etc.
This hook can only be called in a component that is a child (nested child is okay!) of the DoormanProvider, or withPhoneAuth. It doesn't have to be a direct child, but it just has to be inside of it somewhere.
Let Doorman handle the logic 😇
Don't feel like writing a bunch of useState calls in your custom flow?
You're in luck. You can use usePhoneAuthState, which has a global, shared state across your app of the current onboarding state.
What does that even mean? Let's see with code
If you handle the logic/state:
Imagine you want to build your auth screens from scratch. If you handled the state, it might look like this:
// first on your phone screen, inside of your component: