在选择同一行中的另一个单选按钮后,语义 UI React table 中的单选按钮会保留选中的属性吗?

Radio buttons in a Semantic UI React table retain checked attribute after selecting another radio button in the same row?

我的单选按钮具有相同的名称,因此我期望的行为是:

改为:

为什么这些单选按钮不能完全相互交互?

                  <Form onSubmit={(e) => { handleAnswerFormSubmit(e) }}>
                    <Table celled>
                      <Table.Body>
                        <Table.Row>
                          <Table.Cell>
                            airplane
                          </Table.Cell>
                          <Table.Cell>
                            <Radio name="airplane" value="1" />
                          </Table.Cell>
                          <Table.Cell>
                            <Radio name="airplane" value="2" />
                          </Table.Cell>
                          <Table.Cell>
                            <Radio name="airplane" value="3" />
                          </Table.Cell>
                        </Table.Row>
                      </Table.Body>
                    </Table>
                    <Form.Button>Continue</Form.Button>
                  </Form>

我想你要找的是Radio group。以下示例也可在 Semantic UI React Docs 上找到,将为您提供帮助。代码如下:

export default class RadioExampleRadioGroup extends Component {
  state = {}
  handleChange = (e, { value }) => this.setState({ value })

  render() {
    return (
      <Form>
        <Form.Field>
          Selected value: <b>{this.state.value}</b>
        </Form.Field>
        <Form.Field>
          <Radio
            label='Choose this'
            name='radioGroup'
            value='this'
            checked={this.state.value === 'this'}
            onChange={this.handleChange}
          />
        </Form.Field>
        <Form.Field>
          <Radio
            label='Or that'
            name='radioGroup'
            value='that'
            checked={this.state.value === 'that'}
            onChange={this.handleChange}
          />
        </Form.Field>
      </Form>
    )
  }
}