Skip to content

Please, update the ReadMe. #153

@i-zimmerman

Description

@i-zimmerman

When i try to use the following code from Readme, i get the following error:
1.

  useEffect(() => {
    ValidatorForm.addValidationRule("isPasswordMatch", (value) => {
      if (value !== state.password) {
        return false;
      }
      return true;
    });

    return ValidatorForm.removeValidationRule("isPasswordMatch");
  });

Screenshot 2020-12-06 at 17 39 04

Solution: use code from the DEMO.

My case - React hooks:

 useEffect(() => {
    if (!ValidatorForm.hasValidationRule("isPasswordMatch")) {
      ValidatorForm.addValidationRule("isPasswordMatch", (value) => {
        if (value !== state.password) {
          return false;
        }
        return true;
      });
    }

    return function cleanPasswordMatchRule() {
      if (ValidatorForm.hasValidationRule("isPasswordMatch")) {
        ValidatorForm.removeValidationRule("isPasswordMatch");
      }
    };
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions