Closed mqklin closed 8 years ago
RadioGroup
only renders its children. The Radio
component passes its props to the <input>
element. Therefore this:
<RadioGroup name="fruit" selectedValue={this.state.selectedValue} onChange={this.handleChange}>
{Radio => (
<div className="radio-group">
<Radio value="apple" className="custom-radio-class"/>Apple
<Radio value="orange" />Orange
<Radio value="watermelon" />Watermelon
</div>
)}
</RadioGroup>
renders to:
<div class="radio-group">
<input type="radio" name="fruit" value="apple" class="custom-radio-class">Apple
<input type="radio" name="fruit" value="orange">Orange
<input type="radio" name="fruit" value="watermelon/>Watermelon
</div>
Thanks, @razh, that is right.
it will be nice