How to use the react-admin.minValue function in react-admin

To help you get started, we’ve selected a few react-admin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github minhuyen / generator-expressjs-rest / generators / app / templates / frontend / src / validates / index.js View on Github external
import {
  required,
  minLength,
  maxLength,
  minValue,
  maxValue,
  number,
  regex,
  email,
  choices
} from 'react-admin';

const validateFirstName = [required(), minLength(2), maxLength(15)];
const validateEmail = email();
const validateAge = [number(), minValue(18), maxValue(100)];
const validateZipCode = regex(/^\d{5}$/, 'Must be a valid Zip Code');
const validateSex = choices(['M', 'F'], 'Must be Male or Female');

export {
  validateAge,
  validateEmail,
  validateFirstName,
  validateZipCode,
  validateSex
}