boolean type for radio boxes(at least in radio groups). #484
Unanswered
SalahAdDin
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello here,
We again using this library.
In this time we used it to work to build a form with
react-hook-form
; this form uses a lot of yes/no questions, and for that we are using radio groups(cause it just leave to check one option). Of course, we created our custom controlled component to handle the Input component withreact-hook-form
.Our problem comes when we have to define the available options: a Radio component cannot receive a
boolean
as input, onlystring
,number
orundefined
.Well, passing a
string
value to theController
saves it as astring
and not as aboolean
event if the passed type says it must be aboolean
value.For handling it, we were thinking about parsing it to
Boolean
inonChange
but it is not clear to us how pass this parameter to the RadioGroup since it is expecting aRadioEvent
which just check is the input is checked(why? this is a radio group!!!).Another solution: trying to use a custom transform, and following the example, we couldn't make match any types on the custom component, so we dismissed this possibility.
So, what would be the correct way to handle it? Could it be possible to have a specific use case for
RadioGroups
for yes/no questions?You can find the project here and the sandbox here.
Thank you very much.
Beta Was this translation helpful? Give feedback.
All reactions