Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.38 KB

README.md

File metadata and controls

44 lines (32 loc) · 1.38 KB

npm version

lp-form

A drop-in replacemement for the reduxForm() Higher-Order Component from redux-form that adds extra options and functionality.

import React from 'react'
import { compose } from 'recompose'
import { Field } from 'redux-form'
import { lpForm } from 'lp-form'
import { Input, SubmitButton } from 'lp-components'

function MyForm({ handleSubmit }) {
  return (
    <form onSubmit={handleSubmit}>
      <Field name="name" component={Input} />
      <SubmitButton> Submit </SubmitButton>
    </form>
  )
}

export default compose(
  lpForm({
    name: 'MyForm',
    // Constraints is a special option that adds validations to the form.
    constraints: { name: { presence: true } },
  })
)(MyForm)

All available options and enhancements can be found in the documentation.

Documentation

Documentation and usage info can be found in docs.md.

Migration Guides

Contribution

This package follows the Opex NPM package guidelines. Please refer to the linked document for information on contributing, testing and versioning.