Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用反应,我正在尝试使用传播语法。由于某种原因,它不起作用并给出错误:
const { className, children, ...otherprops } = this.props;
知道我做错了什么吗?
你得到Unexpected token是因为你缺少一个 babel 预设,stage-0
Unexpected token
stage-0
使用stage-0,它可以工作
没有stage-0,它不起作用
为了添加它,您必须
1º 安装它
npm install --save-dev babel-preset-stage-0
2º 添加到.babelrc
.babelrc
{ "presets": ["react","es2015","stage-0"] }