2.3.1 getlnitialState和getDefaultProps错误
foxconn-quality-inspector opened this issue · comments
富士康质检员 commented
class Sample extends React.Component {
constructor(props) {
super(props);
this.state = { foo: "’bar " };
}
});
Sample.defaultProps = {
return { sampleProp: 0 }
};
报错
正确:
class Sample extends React.Component {
constructor(props) {
super(props);
this.state = { foo: "’bar " };
}
}
Sample.defaultProps = {
sampleProp: 0
};