ES6常用新语法
- 定义常量/变量: const/let
- 解构赋值: let {a, b} = this.props import {aa} from 'xxx'
- 对象的简洁表达: {a, b}
- 箭头函数:
- 常用场景
* 组件的自定义方法: xxx = () => {}
* 参数匿名函数
-
- 优点:
* 简洁
* 没有自己的this,使用引用this查找的是外部this
- 扩展(三点)运算符: 拆解对象(const MyProps = {}, <Xxx {...MyProps}>)
- 类: class/extends/constructor/super
- ES6模块化: export default | import