From 4a19e2a762c69a5400dffad25596a4425bcf71f8 Mon Sep 17 00:00:00 2001 From: angel1285528 Date: Mon, 20 May 2024 14:21:10 -0600 Subject: [PATCH] se restable archivo de error de componente --- .../ui/forms-fields/errorComponent.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 app/(gestionatl)/ui/forms-fields/errorComponent.tsx diff --git a/app/(gestionatl)/ui/forms-fields/errorComponent.tsx b/app/(gestionatl)/ui/forms-fields/errorComponent.tsx new file mode 100644 index 0000000..0a40aee --- /dev/null +++ b/app/(gestionatl)/ui/forms-fields/errorComponent.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { FieldError, FieldErrorsImpl, Merge } from 'react-hook-form'; // Importa FieldErrorsImpl + +type ErrorMessageProps = { + error?: FieldError | Merge> | null; +}; + +const ErrorMessage: React.FC = ({ error }) => { + if (!error || typeof error.message !== 'string') return null; + + return {error.message}; +}; + +export default ErrorMessage; \ No newline at end of file