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
Copy file name to clipboardExpand all lines: auth/README.md
+23-10Lines changed: 23 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,29 +2,35 @@
2
2
3
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.
4
4
5
+
All hooks can be imported from `react-firebase-hooks/auth`, e.g.
6
+
7
+
```
8
+
import { useAuthState } from 'react-firebase-hooks/auth';
Returns the `firebase.User` (if logged in), a boolean to indicate whether the the user is still being loaded and any `firebase.FirebaseError` returned by Firebase when trying to load the user.
14
22
15
-
Returns:
16
-
`AuthStateHook` containing:
23
+
The `useAuthState` hook takes the following parameters:
17
24
18
-
-`initialising`: If the listener is still waiting for the user to be loaded
19
-
-`user`: The `firebase.User`, or `null`, if no user is logged in
25
+
-`auth`: `firebase.auth.Auth` instance for the app you would like to monitor
Returns an array of `firebase.database.DataSnapshot` (if a reference is specified), a `boolean` to indicate if the data is still being loaded and any `firebase.FirebaseError` returned by Firebase when trying to load the data.
22
30
23
-
Returns:
24
-
`ListHook` containing
31
+
The `useList` hook takes the following parameters:
25
32
26
-
-`error`: An optional error object returned by Firebase
27
-
-`loading`: A `boolean` to indicate if the listener is still being loaded
28
-
-`value`: A list of `firebase.database.DataSnapshot`
33
+
-`reference`: (optional) `firebase.database.Reference` for the data you would like to load
As `useList`, but this hook returns a list of the `firebase.database.DataSnapshot.key` values, rather than the the `firebase.database.DataSnapshot`s themselves.
65
71
66
-
-`ref`: `firebase.database.Reference`
72
+
The `useListKeys` hook takes the following parameters:
67
73
68
-
Returns:
69
-
`ListKeysHook` containing
74
+
-`reference`: (optional) `firebase.database.Reference` for the data you would like to load
70
75
71
-
-`error`: An optional error object returned by Firebase
72
-
-`loading`: A `boolean` to indicate if the listener is still being loaded
73
-
-`value`: A list of `firebase.database.DataSnapshot.key` values
Returns a`firebase.database.DataSnapshot` (if a reference is specified), a `boolean` to indicate if the data is still being loaded and any `firebase.FirebaseError` returned by Firebase when trying to load the data.
97
97
98
-
Returns:
99
-
`ObjectHook` containing
98
+
The `useObject` hook takes the following parameters:
100
99
101
-
-`error`: An optional error object returned by Firebase
102
-
-`loading`: A `boolean` to indicate if the listener is still being loaded
103
-
-`value`: A `firebase.database.DataSnapshot`
100
+
-`reference`: (optional) `firebase.database.Reference` for the data you would like to load
0 commit comments