I want to use if statement in map function. Here is the code which I am using:
_collapsible() {
return (
<View style={styles.section}>
<View style={CssHelper['flexRowCentered']}>
{ data['items'].map((item, index) =>
<FilterButton key={index} status={STATUS_DEFAULT_FILTER_BUTTON} style={styles.brandContainer}>
<ImageBackground style={styles.brand} source={item.source} resizeMode="contain"/>
</FilterButton>
//((index + 1) % 3 === 0) && <View style={CssHelper['verticalDivider']}></View>
)}
</View>
</View>
);
}
.mapcall - try wrapping the return value of themapfunction in a<React.Fragment>.