import { ReactNode } from "react"
import { FieldError } from "react-hook-form";

type TValidationErrorProps = {
  children?: ReactNode;
  error?: FieldError;
}

const ValidationError = ({
  children,
  error
}: TValidationErrorProps) => {
  return (
    <p className='text-red-500 text-sm'>{error?.message || children}</p>
  )
}

export default ValidationError