React Hooks for Firebase.
APACHE-2.0 License
Bot releases are visible (Hide)
useIdToken
- thanks @vwxyutaroooFull Changelog: https://github.com/CSFrequency/react-firebase-hooks/compare/v5.1.0...v5.1.1
It's been a while since the last release, so this has been a bit of a housekeeping release focused on landing outstanding PRs and resolving a few of the simpler issues that have been reported.
I'm aware there are some outstanding issues with React 18 that require some deeper investigation and these will be tackled in a future release.
Special thanks to @levino for putting a test framework in place and adding our first test. We would welcome PRs with additional tests to improve the resilience of the library!
useSendPasswordResetEmail
- thanks to @mparsakiauseDeleteUser
- thanks to @RobertSasakuseSignOut
- thanks to @RobertSasakuseVerifyBeforeUpdateEmail
- thanks to @skratchdotuseIdToken
#223useSendSignInLinkToEmail
and useSignInWithEmailLink
#261useCollection
and useDocument
now supports an optional initialValue
option which sets the default value for hooks. This had been missed in the upgrade from v3 to v4 - thanks to @mauriceackel and @dylanwatsonsoftwarecreateUser
and signInWithXXX
hooks will return the UserCredential
when successful #251updateXXX
and sendXXX
hooks will return a boolean
to indicate success or failureuseCallback
to prevent unnecessary renders - thanks to @wong2 and @pzmudzinskiFull Changelog: https://github.com/CSFrequency/react-firebase-hooks/compare/v5.0.3...v5.1.0
Published by chrisbianca over 2 years ago
This is one of the biggest releases for a while, bringing a raft of simplifications to the underlying code and a number of new hooks to support a greater breadth of Firebase functionality.
useCollectionData
and useDocumentData
hooks no longer supports idField
, refField
or transform
options as these are incompatible with the new Firebase v9 typings. Instead, use the built in FirestoreDataConverter
functionality to control how the snapshots returned by Firebase are converted.useSignInWithApple
, useSignInWithFacebook
, useSignInWithGithub
, useSignInWithGoogle
, useSignInWithMicrosoft
, useSignInWithTwitter
and useSignInWithYahoo
- thanks to @isaiah-solo for the original useSignInWithGoogle
hook that was adapted.useUpdateEmail
, useUpdatePassword
and useUpdateProfile
useSendPasswordResetEmail
and useSendEmailVerification
useHttpsCallable
hook to allow callable Cloud Functions to be executeduseToken
hook to allow access to the Cloud Messaging tokenuseUploadFile
hook to allow files to be uploaded to Cloud Storage - thanks to @dohomi for the inspirationuseAuthState
now supports an optional onUserChanged
option to allow custom functions to be called when a user changes, e.g. to access custom claims (#139) - thanks to @dohomiuseCollectionData
and useDocumentData
now return the snapshot
object to allow access to things like metadatause***Once
hooks now return a reload
function to allow manual reloading of the datause***Once
hooks now protect against race conditions (#201) - thanks to @mrtnkbFull Changelog: https://github.com/CSFrequency/react-firebase-hooks/compare/v4.0.1...v5.0.0
A big thank you to @andipaetzold who made the underlying changes for this release.
react-firebase-hooks
to support Firebase v9, the new modular SDK from Firebase. Whilst there should be no changes required to the way that you interact with react-firebase-hooks
, a number of changes will need to be made to how you interact with the underlying Firebase SDKs. More can be found here.useList
when a new child is added (#141) - thanks to @cryser29IDOptions
to prevent tsc compilation issues (#135) - thanks to @SnailedAuthActionHook
to prevent compilation issues. Fixes #127emailVerificationOptions
when using useCreateUserWithEmailAndPassword
(#125 and #130) - thanks to @dohomirefField
as Reference
refField
as DocumentReference
(#126 ) - thanks to @dangreaveswithConverter
(#129) - thanks to @berdyshevreact-firebase-hooks
requires Firebase v8 or higher (#86) - thanks to @mdirolfuseCreateUserWithEmailAndPassword
and useSignInWithEmailAndPassword
hooks (#98) - thanks to @lorstenoplotransform
option for realtime database hooks (#95) - thanks to @satyamrefField
that is populated with the firebase.firestore.QuerySnapshot.ref
property (#80) - thanks to @mauriceackelsnapshotOptions
(#78)transform
option for firestore hooksuseList
efficiency (#90) - thanks to @caleb-harrelsonuseAuthState
(#107) - thanks to @kqitokeyField
and refField
to genericsidField
and refField
to generics (#50)firestore.DocumentReference
type information to all hooks (#67)useMemo()
for value fetching hooks to prevent unnecessary re-renders https://github.com/CSFrequency/react-firebase-hooks/pull/41 - thanks to @yprestoundefined
instead of void
#26value
field when Firebase returns an error
error
field when Firebase returns a value
const [value, loading, error] = useHook();
options
object parameter which contains all optional parameters:
Firestore:
useCollection(query, options)
is now useCollection(query, { snapshotListenOptions })
useCollectionOnce(query, options)
is now useCollectionOnce(query, { getOptions })
useCollectionData(query, options, idField)
is now useCollectionData(query, { idField, snapshotListenOptions })
useCollectionDataOnce(query, options, idField)
is now useCollectionDataOnce(query, { getOptions, idField })
useDocument(ref, options)
is now useDocument(ref, { snapshotListenOptions })
useDocumentOnce(ref, options)
is now useDocumentOnce(ref, { getOptions })
useDocumentData(ref, options, idField)
is now useDocumentData(ref, { idField, snapshotListenOptions })
useDocumentDataOnce(ref, options, idField)
is now useDocumentDataOnce(ref, { getOptions, idField })
Database:
useListVals<T>(ref, keyField)
is now useListVals<T>(ref, { keyField })
useObjectVal<T>(ref, keyField)
is now useObjectVal<T>(ref, { keyField })
firebase.auth.Error
rather than firebase.FirebaseError
as this is what the auth
methods return from the SDKError
rather than firebase.FirebaseError
as this is what the firestore
methods return from the SDK