Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Type Script - React Native : What is the best practice way to write ternary inside ternary?

$
0
0

What is the best practice way to write ternary inside ternary like in my example code?I want to make the code more readable and correct and I want to know the correct way to write it.

<TouchableOpacity            style={              darkMode                ? filterState === 'A'                  ? styles.activeButtonDark                  : styles.buttonDark                : filterState === 'A'                ? styles.activeButton                : styles.button            }></TouchableOpacity><TouchableOpacity            style={              darkMode                ? filterState === 'B'                  ? styles.activeButtonDark                  : styles.buttonDark                : filterState === 'B'                ? styles.activeButton                : styles.button            }></TouchableOpacity>

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>