Example of using with Tailwind Headless UI #5834
Unanswered
thejoyfuldev
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I saw a few individuals having trouble using this with Tailwind Headless UI. More specifically, they are receiving errors about not being able to pass ref to function components. This is caused by attempting to use spread syntax to pass all arguments from
field
(including ref) intoListbox
(or other component).There are many ways to solve this. The first, would be to destructure
field
The option that I personally prefer since I am typically creating a custom component anyway is to further integrate react-hook-form and use the hook
useController
. This allows my calling component to be much cleaner and reduce the overall lines within my form.I've included the gist and sandbox below to show this option.
Gist: Headless UI with React Hook Forms
Codesandbox
Beta Was this translation helpful? Give feedback.
All reactions