0

enter image description here

Don't know what went wrong can anyone explain, I wrote register according to the documentation but it's still giving - enter image description here

Please help

2
  • I'll admit that I haven't used react-hook-form, but it seems like you're passing a bare function as an unnamed prop to that Input. What is the block with register supposed to be? Commented Apr 9, 2021 at 21:57
  • What does it show when you do console.log(typeof path) inside get.ts? You can also try doing console.dir(path) to gain more information. Commented Apr 9, 2021 at 22:00

1 Answer 1

4

You use React Hook Form v7 with wrong syntax, here is a working example:

The field name is passed as the first arg of register

<input
  type="text"
  {...register("FIELD_NAME", { required: required, validate: validation })}
/>

React Hook Form V7 - Register API Documentation

React Hook Form V6 - Register API Documentation

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.