2

Currently I'am working on my authentication flow of react native navigation. Right now I'am already done setup my state management and the login module part. Now the problem is when I console log my state of isLoggedIn of true itself the true value turns to false, Which is I don't understand why the value that I set to the state change back to false.

Question: Why my state isLoggedIn true turns back to false value?

Goal: If I console log the state isLoggeIn the set value may not turn to false, because I am already authenticated.

React Navigation Version: 5

Here is my Navigation:

const Navigation = () => {
    
    const {isLoggedIn, isLoading} = useSelector(state => state.user)
    
    console.log(isLoggedIn,"isLoggeIn")

    return (
        <NavigationContainer>

            {
                isLoggedIn ? (
                    <UnauthenticatedUser />
                ) : (
                    <AuthenticatedUser />
                )
            }
           

        </NavigationContainer>
    )
}

export default Navigation

Here is the logs details:

Logs Illustration

DevGe
  • 1,381
  • 4
  • 35
  • 66

0 Answers0