Skip to content

States don't update inside the firebase auth onAuthStateChanged callback #4189

Answered by markerikson
koroman17 asked this question in Help
Discussion options

You must be logged in to vote

@koroman17 Because you've created a closure that captures the value of status at the time the function that was created, and thus it can never see any other value.

You might want to read Dan Abramov's post A Complete Guide to useEffect to better understand why this happens.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@koroman17
Comment options

Answer selected by koroman17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #4188 on October 12, 2021 14:26.