import React from 'react' ; import { LabelProps } from '../../FieldProps' ; const FieldValidationErrors = ( props ) => { if ( props . fieldValidationErrorsComponent ) { const CustomError = props . fieldValidationErrorsComponent ; const { fieldValidationErrorsComponent , ... errorsComponentProps } = props ; return < CustomError { ... errorsComponentProps } / > ; } const { errors } = props ; if ( ! errors || errors . length === 0 ) { return null ; } return ( < div className = "invalid" > { errors . map ( ( error , index ) => ( < p key = { index } > { error } < /p>))} < /div>); } ; export { FieldValidationErrors } ;