为什么react的组件要super(props)-灵析社区

万码F5GTP6P0

![https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724824307544_Akai.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724824307544_Akai.png) 如图,我知道supert是继承constructor的参数,但是为什么在react里面,有一些组件使用了super(props),而有一些没有写,还有在es6里就只是写了supert(),这些区别在哪呢?以及这里的这个constructor(props)...super(props)是起到什么作用呢 这个是全代码: ![https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724824317832_Mixv.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724824317832_Mixv.png)

阅读量:167

点赞量:0

问AI