[英]I'm getting no errors when using react on vscode
I'm using vscode and I'm trying to learn react.我正在使用 vscode 并且我正在尝试学习反应。
This what it shows me:这是它向我展示的:
This code can't run because I don't access to item, but it show me no error...此代码无法运行,因为我无法访问项目,但它没有显示任何错误...
I started watch video about react and this how it supposed to look like, as it on his computer:我开始观看有关 react 的视频,以及它在他电脑上的样子:
EDIT: I've installed eslint https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint编辑:我已经安装了 eslint https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
and now it show me the error.现在它向我展示了错误。
Your variable item
is not defined.您的变量
item
未定义。 You need to define that previously.您需要事先定义它。
Also, in your context the key
prop on your first div is not needed, as you're not looping through an array of elements and rendering DOM elements for them.此外,在您的上下文中,不需要第一个 div 上的
key
prop,因为您没有遍历元素数组并为它们呈现 DOM 元素。
在 Card 组件的第一行进行以下更改: const Card=({item})=>{ ... }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.