import React from 'react'; import { Field as FormikField, FieldProps } from 'formik'; import classNames from 'classnames'; interface OwnProps { name: string; light?: boolean; label?: string; description?: string; validate?: (value: any) => undefined | string | Promise; } type Props = OwnProps & Omit, 'name'>; const Field = ({ id, name, light = false, label, description, validate, className, ...props }: Props) => ( { ({ field, form: { errors, touched } }: FieldProps) => ( {label && } {touched[field.name] && errors[field.name] ?

{(errors[field.name] as string).charAt(0).toUpperCase() + (errors[field.name] as string).slice(1)}

: description ?

{description}

: null }
) }
); export default Field;