redux-form-validation-so-easy
Some useful validation helpers for quick developing with redux-form.
Installation
npm install --save redux-form-validation-so-easy
Usage
Let's assume we are working with redux-form's sync validations, then you would have code like this:
const validate => { ... //MY UGLY LENGTHY RULES :( ...} const SyncValidationForm = { ...} form: 'syncValidation' validateSyncValidationForm
For some reasons I want to split those validation logics to somewhere and make them reusable, so let me introduce my helpers and just replace the original validate
function like this:
const validate = const UserForm = { return <form onSubmit=propshandleSubmit> <Field name="username" component=renderField type="text" label="Name"/> <Field name="id" component=renderField type="text" label="ID" /> <Field name="email" component=renderField type="email" label="Email"/> </form> }) form: 'user' validateUserForm
Available helpers (so far)
- vEmail()
- vROCId()
- vMoreThan(number)