import React from 'react'; import { Field, FieldProps } from 'formik'; import InputError from '@/components/elements/InputError'; import Label from '@/components/elements/Label'; interface Props { id?: string; name: string; children: React.ReactNode; className?: string; label?: string; description?: string; validate?: (value: any) => undefined | string | Promise; } const FormikFieldWrapper = ({ id, name, label, className, description, validate, children }: Props) => ( {({ field, form: { errors, touched } }: FieldProps) => (
{label && } {children} {description || null}
)}
); export default FormikFieldWrapper;