We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 768664a commit a2dfa1aCopy full SHA for a2dfa1a
auth/useAuthState.ts
@@ -1,4 +1,4 @@
1
-import { Auth, User } from 'firebase/auth';
+import { Auth, onAuthStateChanged, User } from 'firebase/auth';
2
import { useEffect, useMemo } from 'react';
3
import { LoadingHook, useLoadingValue } from '../util';
4
@@ -11,11 +11,7 @@ export default (auth: Auth): AuthStateHook => {
11
>(() => auth.currentUser);
12
13
useEffect(() => {
14
- const listener = auth.onAuthStateChanged(setValue, setError);
15
-
16
- return () => {
17
- listener();
18
- };
+ return onAuthStateChanged(auth, setValue, setError);
19
}, [auth]);
20
21
const resArray: AuthStateHook = [value, loading, error];
0 commit comments