score:1

you can combine the steps of computing each validation step and setting the state into one statement:

validationrules = (param) => {
  console.log("password", param);
  this.setstate({
    charlength: this.islength(param),
    lowercase: this.lowercase(param),
    uppercase: this.uppercase(param),
    number: this.isnumber(param),
  });
};

edit: also fyi, return str.length > 2 ? true : false; can just be shortened to return str.length > 2;


Related Query

More Query from same tag