摘要:
一、类组件 类组件,顾名思义,也就是通过使用ES6类的编写形式去编写组件,该类必须继承React.Component 如果想要访问父组件传递过来的参数,可通过this.props的方式去访问 在组件中必须实现render方法,在return中返回React对象,如下: class Welcome e 阅读全文
摘要:
一、ES6类 在ES6中,通过extends关键字实现类的继承,方式如下: class sup { constructor(name) { this.name = name } printName() { console.log(this.name) } } class sub extends su 阅读全文