simpl-schema-to-redux-form
v1.0.1
Published
SimpleSchema to Redux Form
Downloads
5
Readme
simpl-schema-to-redux-form
SimpleSchema to Redux Form
Create a validation context
import SimpleSchema from 'simpl-schema'
import { simpleSchemaToReduxFormValidator } from 'simpl-schema-to-redux-form'
// Create your own schema
const schema = new SimpleSchema({ ... })
// Create a validation context for this schema
const ctx = mainSchema().newContext()
// Create your validate function for redux-form
const validate = simpleSchemaToReduxFormValidator(ctx)
Current values and validation state
The created validate
function exposes 2 members: values
, errors
.
Add logger
In development, you can log each call to the validation function by passing a logger.
const validate = simpleSchemaToReduxFormValidator(ctx, console)