Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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