'Why my state on my redux toolkit reset itself to the old state?
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:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

