【发布时间】:2018-07-01 06:48:49
【问题描述】:
我尝试运行App Bar 演示中的最后一个示例,但出现错误:
ERROR in ./src/Root.js
Module build failed: SyntaxError: Unexpected token (28:8)
26 |
27 | class MenuAppBar extends React.Component {
> 28 | state = {
| ^
29 | auth: true,
30 | anchorEl: null,
31 | };
部分代码
class MenuAppBar extends React.Component {
state = {
auth: true,
anchorEl: null,
};
handleChange = (event, checked) => {
this.setState({ auth: checked });
};
handleMenu = event => {
this.setState({ anchorEl: event.currentTarget });
};
handleClose = () => {
this.setState({ anchorEl: null });
};
依赖
- “material-ui”:“^1.0.0-beta.30”
- “反应”:“^16.2.0”
- “react-dom”:“^16.2.0”
- “babel-cli”:“^6.26.0”
- “babel-core”:“^6.26.0”
- “babel-loader”:“^7.1.2”
- “babel-preset-env”:“^1.6.1”
- "babel-preset-es2017": "^6.24.1"
- “babel-preset-react”:“^6.24.1”
- “webpack”:“^3.10.0”
.babelrc
{
"presets": ["env","react"]
}
如何运行它?
【问题讨论】:
标签: material-ui