You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**This documentation is for v3 of React Firebase Hooks which involved a number of breaking changes, including adding support for Firebase v8.0.0 - more details [here](https://github.com/CSFrequency/react-firebase-hooks/releases/tag/v3.0.0). For v2 documentation, see [here](https://github.com/CSFrequency/react-firebase-hooks/tree/v2.2.0).**
8
+
This documentation is for v4 of React Firebase Hooks which makes the package compatible with Firebase v9 and drops support for previous versions of Firebase - more details [here](https://github.com/CSFrequency/react-firebase-hooks/releases/tag/v4.0.0).
9
+
10
+
- For v3 documentation (Firebase v8), see [here](https://github.com/CSFrequency/react-firebase-hooks/tree/v3.0.0).
11
+
- For v2 documentation, see [here](https://github.com/CSFrequency/react-firebase-hooks/tree/v2.2.0).
9
12
10
13
## Installation
11
14
12
-
React Firebase Hooks v3 requires **React 16.8.0 or later** and **Firebase v8.0.0 or later**.
15
+
React Firebase Hooks v4 requires **React 16.8.0 or later** and **Firebase v9.0.0 or later**.
13
16
14
17
> Official support for Hooks was added to React Native in v0.59.0. React Firebase Hooks works with both the Firebase JS SDK and React Native Firebase, although some of the typings may be incorrect.
Copy file name to clipboardExpand all lines: auth/README.md
+18-15
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# React Firebase Hooks - Auth
2
2
3
-
React Firebase Hooks provides a convenience listener for Firebase Auth's auth state. The hook wraps around the `firebase.auth().onAuthStateChange()` method to ensure that it is always up to date.
3
+
React Firebase Hooks provides a convenience listener for Firebase Auth's auth state. The hook wraps around the `auth.onAuthStateChange(...)` method to ensure that it is always up to date.
4
4
5
5
All hooks can be imported from `react-firebase-hooks/auth`, e.g.
6
6
@@ -24,30 +24,33 @@ Retrieve and monitor the authentication state from Firebase.
24
24
25
25
The `useAuthState` hook takes the following parameters:
26
26
27
-
-`auth`: `firebase.auth.Auth` instance for the app you would like to monitor
27
+
-`auth`: `auth.Auth` instance for the app you would like to monitor
28
28
29
29
Returns:
30
30
31
-
-`user`: The `firebase.User` if logged in, or `undefined` if not
31
+
-`user`: The `auth.User` if logged in, or `undefined` if not
32
32
-`loading`: A `boolean` to indicate whether the the authentication state is still being loaded
33
-
-`error`: Any `firebase.auth.Error` returned by Firebase when trying to load the user, or `undefined` if there is no error
33
+
-`error`: Any `AuthError` returned by Firebase when trying to load the user, or `undefined` if there is no error
34
34
35
35
#### If you are registering or signing in the user for the first time consider using [useCreateUserWithEmailAndPassword](#usecreateuserwithemailandpassword), [useSignInWithEmailAndPassword](#usesigninwithemailandpassword)
Login a user with email and password. Wraps the underlying `firebase.auth().signInWithEmailAndPassword` method and provides additional `loading` and `error` information.
171
+
Login a user with email and password. Wraps the underlying `auth.signInWithEmailAndPassword` method and provides additional `loading` and `error` information.
169
172
170
173
The `useSignInWithEmailAndPassword` hook takes the following parameters:
171
174
172
-
-`auth`: `firebase.auth.Auth` instance for the app you would like to monitor
175
+
-`auth`: `Auth` instance for the app you would like to monitor
173
176
174
177
Returns:
175
178
176
179
-`signInWithEmailAndPassword(email: string, password: string)`: a function you can call to start the login
177
-
-`user`: The `firebase.User` if the user was logged in or `undefined` if not
180
+
-`user`: The `auth.User` if the user was logged in or `undefined` if not
178
181
-`loading`: A `boolean` to indicate whether the the user login is processing
179
-
-`error`: Any `firebase.auth.Error` returned by Firebase when trying to login the user, or `undefined` if there is no error
182
+
-`error`: Any `Error` returned by Firebase when trying to login the user, or `undefined` if there is no error
0 commit comments