I write React class constructor use es6, but there is a red highlight error in webstorm9 editor here is the part of code:
class AssetSelectDialog extends React.Component {
static propTypes = {
data: React.PropTypes.any,
pageState: React.PropTypes.string,
pageStatus: React.PropTypes.string,
handleCancel: React.PropTypes.func,
handleSave: React.PropTypes.func
};
constructor(props) {
super(props);
this.PAGE_STATUS = {
SHOW: 'SHOW',
SELECT: 'SELECT'
};
this.state = {
data: this.props.data || {},
pageState: this.props.pageState || CONST.STATUS.EDIT,
pageStatus: this.props.pageStatus || this.PAGE_STATUS.SHOW
};
}
there error was found in super(props);
and the message is Superclass constructor invocation should be in constructor body
.
the code is run ok in babel., how can I fixed it?