Replies: 1 comment
-
Because this is the underlying type of a native select. |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey developers,
I was checking out the radix-ui documentation API, and it mentions that both
defaultValue
andvalue
types always have to be strings. But I'm curious why it's necessary for them to always be strings ?In my project, I'm using the
Select component
from radix, and myoptions value
looks like this:In our project, the
value key
sometimes has astring value
, and in other cases, it might have anumber value
. Occasionally, we pass this value key todefaultValue
.However, the problem arises when we pass a number to it. TypeScript shows a warning message:
So, my question remains: Why is it necessary for
defaultValue
andvalue
to always be of type string? for what reason ? for what logics ? i want to understand the purpos.Beta Was this translation helpful? Give feedback.
All reactions