Default radio button value is not selected if value is number #10704
Unanswered
RamsayRomero
asked this question in
Q&A
Replies: 2 comments
-
Did you find a solution for it? |
Beta Was this translation helpful? Give feedback.
0 replies
-
any update on this ? |
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
-
Here's a Codesandbox that illustrates my question. https://codesandbox.io/s/wandering-microservice-9xvqwv?file=/src/App.tsx
If I have radio buttons with number values and a default value that is one of those numbers, it will not be selected on the first render. However, if I make the default value the same number as a string, then it will be selected on the first render. I would like to understand why this is occurring, and why this issue does not occur for a select input. If I have a select input with option values as numbers, the default option will be selected whether or not the default value is a string or a number.
Should I just always parse my default values to be strings instead of numbers just to be safe? And if so, might this be worth mentioning in the docs? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions