So basically here I want my navbar routes to change along with login info from the redux reducer, but the routes stay static.
useEffect(() => {
getUserInfo();
console.log(props.userInfo?. isLoggedIn)
if (props?.userInfo?.isLoggedIn == true) {
setUserState(['profile','dashboard','wallet']);
} else {
setUserState(['sign-in','sign-in','sign-in']);
}
},[props])
So here I store my routes in the useState
hook as an array, but this useEffect
hook does not cast until I change the route by a <Link></Link>
component.
I want it to cast as soon as the redux state changes.