SimpleSchema to Redux Form
yarn add simpl-schema-to-redux-form
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)
The created validate
function exposes 2 members: values
, errors
.
In development, you can log each call to the validation function by passing a logger.
const validate = simpleSchemaToReduxFormValidator(ctx, console)