score:0

useEffect(() => {
 const unsubscribe = auth.onAuthStateChanged((user) => {
   if (user) {
       setCurrentUser(user);
   }

   setLoading(false);
 });

 return () => unsubscribe();
}, []);

Related Query

More Query from same tag