React那些年, 踩过的一些坑(连载中...)

来源:互联网 发布:telnet登录端口 编辑:程序博客网 时间:2024/06/16 18:43

React 组件构造函数: super(props) vs super()

曾经以为以下两种写法, 没什么大区别, 其实这个坑深着呢

constructor(props) {    super();    this.state = this.initData(this.props);

constructor(props) {    super(props);    this.state = this.initData(this.props);  


原创粉丝点击