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
I'm kinda struggling to understand this piece of code!
The unsubscribe fn is run on unmount of this component (context/authContext.js), so how the user and loading states are set to be used in other functions in this component?
I'm kinda struggling to understand this piece of code!
The
unsubscribe
fn is run on unmount of this component (context/authContext.js), so how the user and loading states are set to be used in other functions in this component?useEffect(() => { const unsubscribe = auth.onAuthStateChanged(user => { setCurrentUser(user) setLoading(false) }) return unsubscribe }, [])
The text was updated successfully, but these errors were encountered: