例如:
我写的明明是对的呀
method_ : function(){
...
}
报错的原因是es6在用extends React.Component 创建时变了点东西
要去掉:function 也就是-->
method( ) {
...
}
要去掉:function 也就是-->
method( ) {
...
}
再例如:用React.createClass 初始化变量的老方法
getInitialState(){
return {
isEditing: false
}
}
竟然也报错了,
解决方法是
constructor(props){
super(props);
this.state = { // define this.state in constructor
isEditing: false
}
}