问答题 · 前端 · react · @{ formatTime(detail.create_time) }
在构造函数调用 super 并将 props 作为参数传入的作用是啥?
在调用 super() 方法之前,子类构造函数无法使用 this 引用,ES6 子类也是如此。将 props 参数传递给 super() 调用的主要原因是在子构造函数中能够通过 this.props 来获取传入的 props。
super()
this
props
this.props
微信小程序:前端开发宝典
记住密码 忘记密码