Created
March 30, 2019 15:40
-
-
Save copperwall/e29c956dff1c0a61100610f5d6d7f879 to your computer and use it in GitHub Desktop.
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 FormFieldPropTypes from './FormFieldPropTypes'; | |
import FormDefaultComponentLibrary from './FormDefaultComponentLibrary'; | |
const FormField = ({componentLibrary, ...props}) => { | |
const Component = componentLibrary[props.type]; | |
return <Component {...props} />; | |
} | |
FormField.defaultProps = { | |
checked: false, | |
componentLibrary: FormDefaultComponentLibrary, | |
type: 'text', | |
value: '', | |
}; | |
FormField.propTypes = FormFieldPropTypes; | |
export default FormField; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment