I\'m new to react native. I\'m trying to change the styling of the TextInput when there is an error.
How can I make my code not as ugly?
There are two ways, by inline or calling a function:
1)
const styles = StyleSheet.create({ green: { borderColor: 'green', }, red: { borderColor: 'red', }, });
getstyle(val) { if (val) { return { borderColor: 'red' }; } else { return { borderColor: 'green' }; } }