You can use stop / propagate syntax :
const { styles, ...otherProps } = this.props;
const section = cloneElement(this.props.children, {
className: styles.section,
...otherProps,
});
, , , , 1 Babel. , :
npm install babel-preset-stage-1
Babel. , .babelrc:
"presets": [ "es2015", "react", "stage-1" ]
, OP.
, , styles, ? . , .
:
const styles = { foo: 'bar' };
const { styles: otherStyles, ...otherProps } = this.props;
const section = cloneElement(this.props.children, {
className: otherStyles.section,
...otherProps,
});