-1
Good morning, I’m new to React Native and I’m trying to compare the value of a variable I received through a Textinput with an already preset to generate an Alert and redirect me to another screen, only I can’t make the comparisons work and let alone the variable receive the value to jump screen or not, could give me a strength?
I took the Return to resume the value, but I can’t compare the login-login1 and password-pass1 variables on it.
import React, {useState} from 'react';
import { Sucess } from './src/screens/Sucess';
import { Denied } from './src/screens/Denied';
export default function App(){
const [login1,setlogin1] = useState('');
const [senha1,setsenha1] = useState('');
const ConfereSenha = () => {
let login = "test";
let senha = "1234";
return(
if(login1 != login && senha1 != senha){
alert("Senha incorreta")
<Denied />
} else {
alert("Acesso liberado")
<Sucess />
})
}
<TextInput secureTextEntry={true} placeholder='Login' onChangeText={(login1)=>setlogin1(login1)} maxLength={10}></TextInput>
<TextInput secureTextEntry={true} onChangeText={(senha1)=>setsenha1(senha1)} maxLength={10}
<TouchableOpacity style={styles.botaolog} onPress={ConfereSenha}>ENTRAR</TouchableOpacity>