1.0.1 • Published 6 years ago
react-map-fields-to-props-hoc v1.0.1
map fields to props HOC
This is a simple HOC that maps the values of the designated fields to props.
Example:
import React from 'react'
import mapFieldsToProps from 'react-map-fields-to-props-hoc'
const Login = ({ fields, createField }) => (
<form onSubmit={e => login(fields.email, fields.password)}>
<input type="text" {...createField('email')} />
<input type="password" {...createField('password')} />
<button type="button">login</button>
</form>
)
export default mapFieldsToProps()(Login)