title: firebase signOut() method doesn't sign out
body: <p>I use firebase v9 and created a react hook for convenient verification of user authorization.
  After authorization, I can't log out on the page as if the <code>signOut()</code> method just doesn't work</p>
  <p><strong>firebase.ts</strong></p>
  <pre class="lang-js prettyprint-override"><code>import { initializeApp } from &quot;firebase/app&quot;;
  import {getAuth} from &quot;firebase/auth&quot;;
  
  const firebaseConfig = {
    apiKey: process.env.REACT_APP_FIREBASE_API_KEY,
    authDomain: process.env.REACT_APP_FIREBASE_AUTH_DOMAIN,
    projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID,
    storageBucket: process.env.REACT_APP_FIREBASE_STORAGE_BUCKET,
    messagingSenderId: process.env.REACT_APP_FIREBASE_MESSAGING_SENDER_ID,
    appId: process.env.REACT_APP_FIREBASE_APP_ID
  };
  
  const app = initializeApp(firebaseConfig);
  
  export const auth = getAuth();
  
  </code></pre>
  <p><strong>useAuth.ts</strong></p>
  <pre class="lang-js prettyprint-override"><code>import {useEffect, useState} from &quot;react&quot;;
  
  import {onAuthStateChanged, User} from &quot;firebase/auth&quot;;
  import {auth} from &quot;../firebase&quot;;
  
  export const useAuth = () =&gt; {
    const [isLoggedIn, setIsLoggedIn] = useState(false);
    const [user, setUser] = useState&lt;User | null&gt;(null);
  
    useEffect(() =&gt; {
      const subscriber = onAuthStateChanged(auth, (userInfo) =&gt; {
        if (userInfo) {
          setIsLoggedIn(true);
          setUser(userInfo);
        } else {
          setIsLoggedIn(false);
          setUser(null);
        }
      });
      return () =&gt; {
        subscriber();
      }
    }, []);
  
    return {
      user,
      isLoggedIn,
    };
  }
  </code></pre>
  <p><strong>HomePage.ts</strong></p>
  <pre class="lang-js prettyprint-override"><code>import React from 'react';
  
  import {signOut} from &quot;firebase/auth&quot;;
  import {Navigate} from &quot;react-router-dom&quot;;
  import {useAuth} from &quot;../hooks/useAuth&quot;;
  import {auth} from &quot;../firebase&quot;;
  
  const HomePage = () =&gt; {
    const { isLoggedIn } = useAuth();
  
    const handleLogOut = () =&gt; {
      signOut(auth)
        .then(r =&gt; console.log(r)) // undefined
        .catch();
    };
  
    return (
      {isLoggedIn} ?
        &lt;div&gt;
          &lt;h1&gt;Welcome&lt;/h1&gt;
          &lt;button onClick={handleLogOut}&gt;
            Log Out
          &lt;/button&gt;
        &lt;/div&gt;
        : &lt;Navigate to='/login' /&gt;
    );
  };
  
  export default HomePage;
  </code></pre>
  <p>At the same time, when I refresh the page, the session is not reset and I remain on the home page. What am I doing wrong?</p>