Answer the question
In order to leave comments, you need to log in
How to render different pages in React Native?
I have a token stored in AsyncStorage.
How can I make it so that if token === null one would be rendered, and if there is something in it, another would be rendered?
Answer the question
In order to leave comments, you need to log in
render() {
let token = null;
AsyncStorage.getItem('token')
.then((value) => {
if(value !== null) {
token = value;
}
});
return (
{token !== null ? (
<View>
<Text>Токен есть</Text>
</View>
) : (
<View>
<Text>Токена нет</Text>
</View>
)}
)
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question