I have created a component "App", which has a function componentWillMount defined (it should redirect react router when condition is false).
componentWillMount() {
const isLoggedIn = session.getLogin()
console.log( 'isLoggedIn is', isLoggedIn )
if ( !isLoggedIn ) {
console.log( 'now its false!' )
} else {
console.log( 'else' )
}
return false
}
But the console outputs the following:
isLoggedIn is false
else
Am I doing something wrong? I was thinking that having isLoggedIn set to false, the console should say "now its false!", but it doesn't.
Just to note - session.getLogin() does return sessionstorage.getItem('sessionLoggedIn')
Thank you for anwsers.
Aucun commentaire:
Enregistrer un commentaire