Skip to content

Commit a2dfa1a

Browse files
committed
fix: import onAuthStateChanged
1 parent 768664a commit a2dfa1a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

auth/useAuthState.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Auth, User } from 'firebase/auth';
1+
import { Auth, onAuthStateChanged, User } from 'firebase/auth';
22
import { useEffect, useMemo } from 'react';
33
import { LoadingHook, useLoadingValue } from '../util';
44

@@ -11,11 +11,7 @@ export default (auth: Auth): AuthStateHook => {
1111
>(() => auth.currentUser);
1212

1313
useEffect(() => {
14-
const listener = auth.onAuthStateChanged(setValue, setError);
15-
16-
return () => {
17-
listener();
18-
};
14+
return onAuthStateChanged(auth, setValue, setError);
1915
}, [auth]);
2016

2117
const resArray: AuthStateHook = [value, loading, error];

0 commit comments

Comments
 (0)