Relative Content

Tag Archive for reactjstypescriptreact-hook-form

react-hook-form conditional error message typing

I’m fairly new to using Typescript and I’m having a go at setting up Auth in my first ts React project. I’ve successfully set up validation using react-hook-form in an AuthForm.tsx component that renders the Login form and Sign Up form interchangeably.

reusable custom component in react hook form

so um I’ve been trying to make a reusable Input component so I don’t have to copy paste all of the styles everywhere and I made this
import { FieldValues, UseFormRegister, Path } from ‘react-hook-form’;

Property ‘unsubscribe’ does not exist on type ‘Readonly’

So I have a form with one select (user_id), one input (year) and form to upload PDF document
I made a custom validation using watch from React Hook Form. The problem is that there is a TS error
Property ‘unsubscribe’ does not exist on type ‘readonly (string | File | { file: File; title: string; } | { file: File; title: string; }[])[]’.
What could be the reason ?