React 组件构造函数: super(props) vs super()
曾经以为以下两种写法,没什么大区别,其实这个坑深着呢
- constructor(props) {
- super();
- this.state = this.initData(this.props);
- constructor(props) {
- super(props);
- this.state = this.initData(this.props);
React 组件构造函数: super(props) vs super()
曾经以为以下两种写法,没什么大区别,其实这个坑深着呢
- constructor(props) {
- super();
- this.state = this.initData(this.props);
- constructor(props) {
- super(props);
- this.state = this.initData(this.props);