i'm new to React and made a small gaming component which have indoor
and outdoor
options. In outdoor Item, we have 2 radio buttons and in indoor Item, we have multiple check boxes. My object is we have to get only one value either for outdoor or indoor games fields (indoor games may have multiple values). But not getting any idea how to get the value from these fields.
for Indoor and Outdoor:
<Form>
<Form.Field
as="h4"
control={Radio}
label="Foot-Ball"
key="Foot-Ball"
value="Foot-Ball"
checked={this.props.game === "Foot-Ball"}
onChange={this.props.onChange}
/>
<Form.Field
as="h4"
control={Radio}
label="Cricket"
key="Cricket"
value="Cricket"
checked={this.props.game === "Cricket"}
onChange={this.props.onChange}
/>{" "}
</Form>
I'm getting output in this way
My objective is for the variable game
, either i should get radio button value or i have to get indoor game values but not both in game variable.
Can anyone help me in this?
Here is the working one: "https://codesandbox.io/s/tender-moon-frub1?"