Today I have this inline if which works fine for me
<View style={{justifyContent: 'center'}}>
{returnDayPercentageChange() > 0 ? (
<Icon
style={{color: '#1CDC93', marginTop: 3}}
name="caretup"
size={10}
/>
) : (
<Icon
style={{color: '#FF6767', marginTop: 3}}
name="caretdown"
size={10}
/>
)}
</View>
It works well but I want besides that to have no Icon when the returnDayPercentage === 0, how can I do that?
You can nest ternary operators.
{returnDayPercentageChange() > 0 ? (
<Icon
style={{color: '#1CDC93', marginTop: 3}}
name="caretup"
size={10}
/>) : (
returnDayPercentageChange() < 0 ?
<Icon
style={{color: '#FF6767', marginTop: 3}}
name="caretdown"
size={10}
/> : null)}