简体   繁体   English

在 vscode 上使用 react 时我没有收到任何错误

[英]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.

相关问题 当我什至不写反应时得到反应 tsc 错误 - Getting react tsc errors when I'm not even writing react 当我不使用提交按钮时,不会显示jQuery验证错误 - jQuery validation errors are not shown when I'm not using a submit button 我正在使用Firebase身份验证,但是当我重定向到其他页面时,我没有得到(uid) - I'm using firebase authentication but when I'm redirected to other page I'm not getting (uid) 如何解决我的 React 应用程序中出现数千个错误的问题? - How to fix issue where I'm getting thousands of errors from prettier in my React App? 我在解析 JSON 时遇到错误 - I'm getting errors on parse JSON 如何减少react-redux样板-我尝试创建ComponentFactory,但出现React-redux错误 - How to reduce react-redux boilerplate - I try creating a ComponentFactory but I'm getting react-redux errors 当我尝试通过在反应中使用 useEffect 从 API 获取数据时遇到问题 - I'm fetching a problem when I'm trying to fetch data from an API by using useEffect in react 我在使用 React 测试库的 React 测试中没有收到任何数量的调用 - I'm not Getting any number of calls in my React Test using React Testing Library 当我试图启动我的反应应用程序时,我收到一个不寻常的错误。 它说CleanWebpackPlugin不是构造函数 - I'm getting an unusual error when I'm trying to start my react app. It says that CleanWebpackPlugin is not a constructor 我想使用 CSS 样式设置 JS 文件的样式,但出现错误 - I would like to style JS file in react using CSS styling but I'm getting an error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM