写react时有如下代码
export default class extends PureComponent {
constructor(props) {
super(props);
}
fetch = (props = this.props) => {
const {dispatch, id, form} = props;
// ...
};
}
报如下错误
ReferenceError: Must call super constructor in derived class before accessing ‘this’ or returning from derived constructor
将fetch方法的props参数改名错误消失。
如
fetch = (p = this.props) => {
const {dispatch, id, form} = p;
// ...
};
不知道react搞的什么幺蛾子