Help with understanding how to work with react-hook-form #3726
Unanswered
santafecap
asked this question in
Q&A
Replies: 1 comment
-
Hi, try this const form = useForm();
const { watch } = form
// Example
const watchName= watch("name")
useEffect(() => {
console.log(watchName)
}, [watchName]) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello
I haven't even heard of react-hook-form until starting to use shadcn-ui so please forgive my understanding.
I created a form based off dashboard-03 blocks, specifically there is this starting part:
which as I copied into my project, I was getting the error outlined in #800 however I did not import 'Form' from react-hook-form. the only way I can resolve the error is with:
now what is extremely bothering me is that, I added more variables from useForm() which then produced the previous errors again, and incredulously the only way to solve it is as follows:
while
const {form, register, watch} = useForm();
Does not work!!how could this be that you have to separately declare
form
?? I am not finding anything that explains this behavior on react-hook-form docs.Any insights would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions