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 and usage info can be found in docs.md.
This package follows the Opex NPM package guidelines. Please refer to the linked document for information on contributing, testing and versioning.