我正在按照Grinder教程创建汉堡app,涉及到IT技术。但是我遇到了一个错误:
Line 6: Expected an assignment or function call and instead saw an expression no-unused-expressions
在我自己尝试了之后,我从已完成项目中复制了他的文件,并得到了完全相同的错误,所以我很困惑问题是否出在其他地方,也许是我太糊涂或者他的教程不是最新的。已经尝试添加return语句和更改为大括号,请记住我在其他stackoverflow中看到过这段代码,但它看起来完全相同。
我的代码:
const controls = [
{ label: 'Salad', type: 'salad' }, //line 6 studio code says error is here
{ label: 'Bacon', type: 'bacon' },
{ label: 'Cheese', type: 'cheese' },
{ label: 'Meat', type: 'meat' },
];
const buildControls = (props) => (
<div className ={"BuildControls"}>
{controls.map(ctrl =>(
<BuildControl key={ctrl.label} label={ctrl.label}/>
))}
</div>
);
export default buildControls;
应用程序应该开始显示构建控件,但现在它甚至无法编译。请不要太苛刻,我是这个话题的新手。