React js
when we fill the value in first input is condition ok
if(values.fname.length < 3 && values.lname.length < 3 ){
btnAction = true;
}else{
btnAction = false;
}
this condition work proper
if(values.fname.length < 3 ){
btnAction = true
}else if(values.lname.length < 3 ){
btnAction = true;
}else{
btnAction = false;
}
Top comments (1)
The 2nd condition is equivalent of "or", you can write it like this:
Also, because the expression
values.fname.length < 3 || values.lname.length < 3
already returnstrue
orfalse
, you can rewrite this code like this:btnAction = values.fname.length < 3 || values.lname.length < 3