I make a form using react and material ui, instead of using state to store formdata , i read about react hook forms, that it can handle form submission , validation etc. for a phone number dropdown i am also using react-phone-input2, but in the console , i keep getting the error 'Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'name')' everytime i type number in react phone input. Is there a way the react hook form and react phone input library is clashing??
register,
handleSubmit,
formState: { errors },
watch,
setValue,
name
} = useForm();
<InputLabel
htmlFor="Phone"
className="input-label"
sx={{
minWidth: '120px',
fontWeight: 500,
}}
>
Phone
</InputLabel>
<ReactPhoneInput
name='phone'
variant="outlined"
fullWidth
containerClass="phone-input-container"
{...register('phone', {
required: 'Phone is required',
})}
/>```