首页 > React在es6中使用minxins 无效 具体解决

React在es6中使用minxins 无效 具体解决

class TrainList extends React.Component {
  mixins:[]
  constructor() {
    super();
    this.state = { InputValue: ''};
  }
  
  如何在这里写mixins

mixins是在ES5的写法里面的
ES6把mixins取消了,用类的继承来代替相同的功能

es6的语法可以看阮一峰的书来学习
阮一峰的es6


mixins只能在React.createClass({})中使用, extends的方式目前还不支持.


http://blog.0xfc.cn/2016/04/24/react-decorator/
可以看看decorator


es6下面建议用hoc

【热门文章】
【热门文章】