Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
13 replies
awexis

react hook form + headless ui

from @dingo "Ok so I have a drop-down where you can select something, I want to show the names of the options but the “value” be the database id for them. I think it should be done this way as far as I can tell because I’m just accepting the database id as a string in my zod schema (I use the same schema for my backend route for said action)"

I made it a bit fancy with a generic combobox, so hopefully this helps

https://codesandbox.io/p/sandbox/goofy-scooby-mg9qm7
CodeSandbox is an online editor tailored for web applications.
goofy-scooby-mg9qm7
Was this page helpful?