我还是很新的反应,还在学习es7。
我遇到了问题:
import React from 'react';
import MessageList from './MessageList.jsx';
import mui from 'material-ui';
var ThemeManager = new mui.Styles.ThemeManager();
var Colors = mui.Styles.Colors;
var AppBar = mui.AppBar;
class App extends React.Component {
constructor(){
super();
ThemeManager.setPalette({
primary1Color: Colors.blue500,
primary2Color: Colors.blue700,
primary3Color: Colors.blue100,
accent1Color: Colors.pink400
});
}
static childContextTypes = {
muiTheme: React.PropTypes.object
}
getChildContext(){
return {
muiTheme: ThemeManager.getCurrentTheme()
};
}
render() {
return(
<div>
<AppBar title="Awesome" />
<MessageList />
</div>
);
}
}
export default App;
当我尝试使用webpack-dev-server进行编译时,它返回错误
Module build failed: SyntaxError: D:/learn/react2/src/components/App.jsx: Unexpected token (21:27)
}
static childContextTypes = {
^
muiTheme: React.PropTypes.object
}
我使用带有
的babel编译它"presets": ["react", "es2015"]
我该怎么做才能让它发挥作用?
我使用最新的反应(0.14.4)。
由于