-
Notifications
You must be signed in to change notification settings - Fork 113
Open
Description
I get this error with react-validation@3.0.7:
./src/utils/Validators.js
Module not found: Can't resolve 'validator' in '/Users/xxx/xxx/xxx/xxx/src/utils'
This is my ./src/utils/Validators.js file:
import React from 'react';
import validator from 'validator';
import ValidationErrorMsg from '../containers/ValidationErrorMsg';
export const required = (value) => {
if (!value.toString().trim().length) {
return (
<ValidationErrorMsg msg={'Required field.'} />
);
}
};
export const email = (value) => {
if (!validator.isEmail(value)) {
return "{ value } is not a valid email."
}
};
export const password = (value, props, components) => {
if (value !== components['confirm'][0].value) {
return <span className="error">Passwords are not equal.</span>
}
};
export const exactLength = (value, props) => {
if (value.toString().trim().length !== props.exactLength) {
return <span className="error">The value should be {props.exactLength} characters long.</span>
}
}
```;
phongvanptit
Metadata
Metadata
Assignees
Labels
No labels