I am training in react-native, but I have some comprehension problems.
Why can change the "modalVisible" variable, but I cannot change "aux".
const App = () => {
const [modalVisible, setModalVisible] = useState(0);
var aux = 0;
const _onPress = (code) => {
aux = 1
setModalVisible(code)
};
return (
<SafeAreaView style = {styles.centeredView}>
<View style = {styles.box}>
<Pressable
onPress = {() => _onPress(modalVisible+1)}
style={styles.pressable}
>
<Text style = {{color:'black'}}>{modalVisible} {aux}</Text>
</Pressable></View>
</View>
</SafeAreaView>
);
};
I deleted some views, so it's not ready for a 'crtl + c' 'crtl + v'