-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
In the react app I'm working on, I have controlled state for a form, so I wish to have one radio button be the true
and another be the false
like so (removed specific names for generic sake):
<FormRow
id='js-technical-resources'
onChange={e => myFucntion(e.target.value)}
stacked
type='radio'
>
<FormChoice
key='option 1'
name='option 1'
checked={!stateVariable}
value={false}
>
Option 1
</FormChoice>
<FormChoice
key='Option 2'
name='Option 2'
checked={stateVariable}
value={!!true}
>
Option 2
</FormChoice>
</FormRow>
But this doesn't pass in false
as the value when Option 1
is selected due to this computedValue
in the FormChoice Component.
const computedValue = value || children;
It computes to the {children}
which in this case is just the string Option 1
.
Metadata
Metadata
Assignees
Labels
No labels