我有一组数据,我使用<List dataArray=
在这个循环内部,我想做一些条件检查以确定是否显示某些内容,例如
<List dataArray={ this.state.appointments } renderRow={(data) =>
<View>
#Need to set a variable inside conditional so it only displays once if there are multiple on the same date.
{data.start_actual == formatted_today ?
<ListItem itemDivider style={{backgroundColor: 'crimson'}}>
<Text style={{color: 'white'}}>Today</Text>
</ListItem> : null }
<ListItem>
<Left style={{flex: 0.4}}>
<Text>{data.name}</Text>
</Left>
</ListItem>
</View>
</List>
我的if中的两个值被读作“text”而不是“variables”,我该如何改变?如何在条件语句中设置一个变量,这样我就可以设置它,如果它进入内部所以它不会渲染两次?
由于