import { useForm } from "~/hooks/useForm"; import { FieldValues } from "react-hook-form"; import React from "react"; type Props = { form: ReturnType>; }; const FormErrorMessage = ({ form }: Props) => { const { errors } = form.formState; const error = Object.entries(errors)[0]; if (!error) { return null; } const [key, { message }] = error as any; return (
{`${key}: ${message}`}
); }; export default FormErrorMessage;