应该从localhost上获取API工作吗?

时间:2017-08-30 17:27:22

标签: javascript api

我正在使用React app,我从在线数据库中获取数据。一切似乎都运行正常,除了我没有在DOM中返回的div元素中显示数据。

使用console.log检查项目,提供以下内容:

/src/components/card.js
  Line 2:   'ReactDOM' is defined but never used                 no-unused-vars
  Line 3:   'Autosuggest' is defined but never used              no-unused-vars
  Line 10:  'seriesID' is assigned a value but never used        no-unused-vars
  Line 11:  'seriesNAME' is assigned a value but never used      no-unused-vars
  Line 12:  'banner' is assigned a value but never used          no-unused-vars
  Line 13:  'seriesRunTime' is assigned a value but never used   no-unused-vars
  Line 14:  'seriesGenre' is assigned a value but never used     no-unused-vars
  Line 15:  'seriesOverview' is assigned a value but never used  no-unused-vars
  Line 16:  'seriesRating' is assigned a value but never used    no-unused-vars

因为我正在使用简单的npm init命令在localhost:3000的浏览器中打开我的项目,所以我可能无法获取任何数据吗?

1 个答案:

答案 0 :(得分:0)

您遇到的问题是ESLint正在验证您的代码并且它正在发现问题。看起来您的问题与导入您从未在此文件中实际使用的两个依赖项有关。此外,如果您声明一个变量,但实际上并未使用它,您将看到这些错误。