以这种方式使用对象属性是否可以接受?

Is it acceptable to use object properties that way?

美好的一天。我正在尝试练习使用 react- bootstrap 库。
tutorial 中,我看到了 ES6 代码,这让我有点困惑。

function FieldGroup({ id, label, help, ...props }) {
  return (
    <FormGroup controlId={id}>
      <ControlLabel>{label}</ControlLabel>
      <FormControl {...props} />
      {help && <HelpBlock>{help}</HelpBlock>}
    </FormGroup>
  );
}

在不引用对象的情况下使用单独的对象属性是否可以接受?

这很好。它被称为destructuring。 它比这更干净:

function FieldGroup(props) {
  return (
    <FormGroup controlId={props.id}>
      <ControlLabel>{props.label}</ControlLabel>
      <FormControl {...props} />
      {help && <HelpBlock>{props.help}</HelpBlock>}
    </FormGroup>
  );
}

它也有 not just sending all properties<FormControl /> 的优点,但只是它需要的那些。