In my React Native app I have a <View>
with several other elements nested inside it. Normally if I want to make a component disappear, I make its height go to 0, make its opacity 0, etc. But I want a universal way to apply a style to the <View>
and have it and all its child components disappear.
Does anyone know how I can approach this?
You can use condition inside curly braces in jsx to show or hide component
<View>
{
condition && (
<View> // <- View and its children will show only if condition is true
//Children components
</View>
)
}
</View>