Javascript 此赋值在react组件的此渲染方法中意味着什么

Javascript 此赋值在react组件的此渲染方法中意味着什么,javascript,reactjs,Javascript,Reactjs,在CopyButton组件的render方法中,我们有一行: const{classes,theme,hidden,…other}=this.props 这是什么意思=是赋值运算符,对象(由{}表示)是它的 左值?对象如何成为赋值的左值 另外,..other是什么意思,我知道..是一个展开运算符,但是other代表什么呢 下面是整个代码: export class CopyButton extends Component { static propTypes = { /**

CopyButton
组件的
render
方法中,我们有一行:

const{classes,theme,hidden,…other}=this.props

这是什么意思
=
是赋值运算符,对象(由
{}
表示)是它的 左值?对象如何成为赋值的左值

另外,
..other
是什么意思,我知道
..
是一个展开运算符,但是
other
代表什么呢


下面是整个代码:

export class CopyButton extends Component {
  static propTypes = {
    /**
     * @ignore
     */
    classes: PropTypes.object,
    /**
     * @ignore
     */
    theme: PropTypes.object,

    hidden: PropTypes.bool
  };

  render() {
    //赋值操作的左值是一个对象?
    const { classes, theme, hidden, ...other } = this.props;

    const copyIconStyle =
      theme.direction === 'ltr' ? null : { transform: 'scaleX(-1)' };

    return (
      <Scannable disabled={hidden}>
        <IconButton aria-label="Copy" className={classes.button} {...other}>
          <FileCopy className={classes.icon} style={copyIconStyle} />
        </IconButton>
      </Scannable>
    );
  }
}
导出类CopyButton扩展组件{
静态类型={
/**
*@忽略
*/
类:PropTypes.object,
/**
*@忽略
*/
主题:PropTypes.object,
隐藏:PropTypes.bool
};
render(){
//赋值操作的左值是一个对象?
const{classes,theme,hidden,…other}=this.props;
常数copyIconStyle=
theme.direction=='ltr'?null:{transform:'scaleX(-1)};
返回(
);
}
}
这是与的对象组合

props
对象可能具有一些属性,这些属性随后被分解并分配给局部变量。在这种情况下,
主题
隐藏
,以及其他属性(通过扩展语法)被分配给名为
其他
的对象

const props={
类:“这是一个值”,
主题:"富",,
隐藏:假,
otherProp1:'其他1',
其他建议2:{
nestedProp:“嵌套值”,
},
};
const{classes,theme,hidden,…other}=props;
console.log(类);
console.log(主题);
console.log(隐藏);

控制台日志(其他)这叫做去结构,可以通过数组和对象来完成。在本例中,它是关于props对象的,这里有一些关于对象解构的文档:它是对象解构赋值。。。这里的更多信息这是否回答了你的问题?销毁后,
this.props
仍然保存着这些值(chasses,thems,hidden,…),对吗?@ZhaoGang Destructure,不是销毁。正确的是,分解会使原始对象/数组保持原样。而且,在React状态下,props被视为不可变的。
const { classes, theme, hidden, ...other } = this.props;