Created
September 3, 2016 16:16
-
-
Save itsmepetrov/b736a1145bcd43c06a083fce8649dd32 to your computer and use it in GitHub Desktop.
redux-form Field wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Field } from 'redux-form'; | |
export default function FormField(props) { | |
const { component: Component, ...rest } = props; | |
const renderField = (field) => { | |
const { input, ...other } = field; | |
return ( | |
<Component {...input} {...other} /> | |
); | |
}; | |
return ( | |
<Field | |
component={renderField} | |
{...rest} | |
/> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment