Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
Error Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'name') in React-hook-form

To validate the form, I decided to use the react-hook-form library, when you select the last name in the input in the console, an error occurs as in the screenshot. The input itself is a dadata library and I prescribe all the necessary attributes for the react-hook-form to the component, I think that's why the error occurs, what should I do? And how can this be resolved? I removed all the unimportant part of the code if that.

error screenshot

export default function Fio () {
    const { register, formState: { errors } } = useForm();
    const [value, setValue] = useState();
    return (
        <>
            <span id="FIO">ФИО</span>
            <FioSuggestions
                token={token}
                value={value}
                onChange={setValue}
                {...register( "fio",{required: true})}/><br/>
            <div style={{height: 40}}>
                {errors?.fio && <p>Error</p>}
            </div>
        </>
    )
}
export default function Form () {
    const {handleSubmit} = useForm();
    const onSubmit = (data) => {
        alert(JSON.stringify(data))
    }
        return(
            <form id="formAdv" onSubmit={handleSubmit(onSubmit)}>
                <Fio/>
                <Birthday/><br/>
                <Phone/><br/>
                <label>
                    <input type="radio"
                           name="gender"
                           value="MALE"
                           /> Мужчина
                    <input type="radio"
                           name="gender"
                           value="FEMALE"
                           /> Женщина
                </label><br/>
                <Multiselector/><br/>
                <Selector/><br/>
                <label>
                    <input type="checkbox"/> Не отправлять СМС.
                </label><br/>
                <input type="submit"/>
            </form>
        )
    }
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda