gpt4 book ai didi

reactjs - React 应用程序在本地主机上工作,但在 github 或 heroku 上部署时出错。部署时没有错误

转载 作者:行者123 更新时间:2023-12-05 06:19:11 24 4
gpt4 key购买 nike

我创建了一个 React 应用程序来显示不同国家/地区的电晕感染情况。这在我的本地主机上工作但是当我在 github 或 heroku 上部署它时生成错误。以下错误在 blockquote 中给出。当我检查文件 country.js 时查看错误,没有 n[0]。请帮助下面是指向托管应用程序和应用程序的 github 存储库的链接。

TypeError: "n[0] is undefined" E country.js:13 E country.js:11 React 7 unstable_runWithPriority scheduler.production.min.js:19 React 6 a App.js:22 u runtime.js:45 _invoke runtime.js:274 t runtime.js:97 r asyncToGenerator.js:3 a asyncToGenerator.js:25 react-dom.production.min.js:209:194 React 5 unstable_runWithPriority scheduler.production.min.js:19 React 4 unstable_runWithPriority scheduler.production.min.js:19 React 6 a App.js:22 u runtime.js:45 _invoke runtime.js:274 t runtime.js:97 r asyncToGenerator.js:3 a asyncToGenerator.js:25 TypeError: n[0] is undefined country.js:13:30

this is link to hosted app on herokuthis is link to app hosted on Github

This is github repository

最佳答案

作为stated by Dishant Desai ,它给出了一个 TypeError。为了修复它,你可以从

更改 country.js 中的代码
const countryflag = Object.keys(data).map((name) => {
return data[name][0];
})

const countryflag = data[0];

然后直接这样使用:

${countryflag[country[0]]}

关于reactjs - React 应用程序在本地主机上工作,但在 github 或 heroku 上部署时出错。部署时没有错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60924474/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com