调用 super(props) 的目的是什么


​	在 super() 被调用之前,子类是不能使用 this 的,
	在 ES2015 中,子类必须在 constructor 中调用 super()。

​	传递 props 给 super() 的原因则是便于(在子类中)能在 constructor 访问 this.props。

猜你喜欢

转载自blog.csdn.net/qq_45271323/article/details/106344966
今日推荐