Introduction
Typed React hooks for Firebase — one hook per flow, with its state, errors, and callbacks handled.
Each hook runs one flow end to end. It holds its own loading, error, and success state, and sets up the browser pieces and callbacks the flow needs.
Every action returns a result you can branch on — { success: true, … } when it works, { success: false, error, code, cause } when it doesn't. Firebase's own response is on both paths, unmodified.
Zero dependencies. firebase and react are peers.
Why this package
Whole flows, not single calls
useEmailLinkSignIn reports needsEmail when it needs the address. usePhoneSignIn
creates and cleans up the reCAPTCHA verifier. useOAuthSignIn finishes a redirect
sign-in when the page returns.
Server sessions built in
onIdToken hands you a fresh ID token after every sign-in. onBeforeSignOut runs
before Firebase clears the session, so a failed teardown leaves the user signed in.
Failures are values
Actions never throw. A failed call carries Firebase's own error code and the original error, so you branch on it instead of catching it.
Configure once or per call
Session callbacks, action-code settings, and error wording live on the provider. Any
hook can override them, or opt out with null.
Services
Each service is its own import, so an app only carries what it uses.
| Service | Import | Status |
|---|---|---|
| Core | @timonwa/firebase-hooks | Available |
| Auth | @timonwa/firebase-hooks/auth | Available |
| Firestore | @timonwa/firebase-hooks/firestore | Coming soon |
| Storage | @timonwa/firebase-hooks/storage | Coming soon |
| Cloud Functions | @timonwa/firebase-hooks/functions | Coming soon |
The most-used services ship first; more may follow once these land.