#Resolving Type Mismatch in React Hook Form

3 messages · Page 1 of 1 (latest)

rose oracle
#

I am working on a React form using the React Hook Form library to handle form state. The form contains a field for "learnings" where users can input their learnings. You're encountering a TypeScript error related to type mismatch when using the useFieldArray hook to manage the dynamic list of learning inputs.

Argument of type 'string' is not assignable to parameter of type 'Chapter | Lecture | (Chapter | Lecture)[]'.

errant flower
#

Seems like learnings needs to be an array of objects, not just an array of strings

#

Not sure on the exact rules