This repository was archived by the owner on Jan 26, 2019. It is now read-only.
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
i found if we are using rest props of es6 spread operator it will broken in below behaivor? #64
Closed
Description
import * as React from 'react';
import Demo2 from './Demo2';
export default class XX extends React.Component<any, any> {
render() {
// console.log(Demo2);
const { children, ...restProps } = this.props;
// const x= {};
console.log(restProps);
return (
<div>demo1 {this.props.name}
<div {...restProps}>
<Demo2></Demo2>
</div>
</div>
)
}
}
if we use above code block the vs.code will give me the Demo2 is declared but not used, while build process, it will lose is undefined.
if we change {...restProps} to {...x} it works fine. why?