Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # withForm
- `withForm` is a higher order component that handles all the nitty gritty for managing simple forms, such as hooking up onChange handlers, validation etc.
- ### Simple Example
- ```
- import React from 'react'
- import withForm from 'constructicon/lib/form
- import InputField from 'constructicon/input-field
- const form = {
- email: {
- label: 'Email'
- },
- password: {
- label: 'Password',
- type: 'password'
- }
- }
- const LoginForm = ({
- fields
- }) => (
- <div>
- <InputField {...fields.email} />
- <InputField {...fields.password} />
- </div>
- )
- export default withForm(form)(LoginForm)
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement