I'm pretty confused with the react-native syntax. I was trying to dynamically render a wrapper (CardSection) if numberChildrenLabel is > 0. Then depending on the number children I want to render x number of components. What I'm doing currently doesn't work and I think it's a pretty messy (even if I do fix the syntax errors). What is the best way of rendering multiple components based on an input?
render(){
return(
...
{
this.state.numberChildrenLabel > 0 ?
<CardSection>
<Text style={{ flex: 2}}>Children age:</Text>
<View style={{ flex: 3}}>
{
for(var i=0; i<this.state.numberChildrenLabel; i++){
return(
<Text>child{i}</Text>
);
}
}
</View>
</CardSection>
:
<View/>
}
...
);
}