import React from 'react'; import { useFormContext } from "react-hook-form"; import { Alert } from './' type Props = { text: string; name: string; placeholder: string; additional: string; } export const Input: React.FC = ({text, name, placeholder, additional}) => { const { register, formState: { errors } } = useFormContext(); const options = {required: true, maxLength: 80, additional}; const nameBlock = errors.name; console.log(errors); return( <> {nameBlock && Alert('Данное поле незаполнено') } ) }