会员
周边
新闻
博问
融资
云市场
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
黑熊君
博客园
首页
新随笔
联系
管理
订阅
2018年8月10日
react中constructor和super的使用
摘要: 一:什么时候要用constructor,需要定义state的时候必须要写,要调用super(),而且要传入props参数即super(props)。如果不定义state的话,有无constructor没区别。 二:什么时候要调用super,如果要在子类中使用父类的属性和方法,就要调用super(父类
阅读全文
posted @ 2018-08-10 22:32 黑熊君
阅读(1970)
评论(0)
推荐(0)
编辑
公告