19页 Es6 class 报错
jiexishede opened this issue · 3 comments
jiexishede commented
import React, {Compoment} from 'react';
class Button extends Compoment {
constructor(props){
super(props);
}
static defaultProps = {
color:'blue',
text: 'Confirm',
}
render (){
return (
<button className={'btn btn-${color}'}>
<em>{text}</em>
</button>
);
}
}
static defaultProps = {
这一行里面报错
arcthur commented
static 报错是 babel 的配置问题,请检查一下 babel 里是否加上了 es2015
jiexishede commented
我加了 [stage-0]
arcthur commented
es2015 还是要加的,我一般加的顺序是 ["react", "es2015", "stage-0"]