I just started working with React Native only recently and there was a task I couldn't accomplish. I want to make a screen with a yes/no question. Depending on which one the user chooses, I'll either render a component that I have ready, or just close the screen. Thank you in advance!
2 Answers
You can also use conditions in the jsx code like
render(){
return myCondition ? <MyFirstComponent/> : <MySecondComponent/>
}
or even if their is some nesting you can write
<View>
{...childrens}
{ myCondition ? <MyFirstComponent/> : <MySecondComponent/>}
</View>
or even if only some view
<View>
{...childrens}
{ myCondition && <View> </View>}
</View>