I'm working into functional components and managing the sate by hooks but facing problem into hooks while validation the form.
here is my states:
const [email, setEmail] = useState('');const [password, setPassword] = useState('');const [validEmail, setValidEmail] = useState(true);const [validPassword, setValidPassword] = useState(true);
and here is my validation method is working fine into debug app but facing problem when I released the app.
const validateFields = (): void => {const emailText = emailconst validEmailText = validEmailconst passwordText = passwordconst validPasswordText = validPasswordif (!validEmailText || !emailText) { setValidEmail(false); return;} else if (!validPasswordText || !passwordText) { setValidPassword(false); return;}setIsLoading(true);doSingIn(email, password);
};