In the render
method of CopyButton
component, we have the line:
const { classes, theme, hidden, ...other } = this.props;
What does it mean? =
is an assigngment operator, and an object(denoted by the {}
) is its
left value? How can an object be the left value of an assignment?
Besides, what does ...other
mean, I know that ...
is a expand operator, but what does other
stand for?
Below is the whole piece of codes:
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>
);
}
}