error: TypeError: Cannot read property 'forEach' of undefined
error: TypeError: Cannot read property 'forEach' of undefined
关于 promise 有一些我无法弄清楚的问题,所以当我在搜索栏中输入 'pizza' 并点击 search.Console 时,输出给我这个错误 TypeError: Cannot阅读 属性 'forEach' 未定义
我试图寻找任何拼写错误但找不到任何东西。
这是我的 github 回购:https://github.com/damianjnc/forkifyApp
任何人都可以看到导致错误的原因以及如何调试它?
我可能记错了,但我感觉是这样的(在SearchView.js):
export const renderResults = recipes => {
recipes.forEach(renderRecipe);
};
应该像下面这样:
export const renderResults = recipes => {
recipes.forEach(recipe => renderRecipe(recipe));
};
如果有帮助,请告诉我。干杯!
关于 promise 有一些我无法弄清楚的问题,所以当我在搜索栏中输入 'pizza' 并点击 search.Console 时,输出给我这个错误 TypeError: Cannot阅读 属性 'forEach' 未定义
我试图寻找任何拼写错误但找不到任何东西。
这是我的 github 回购:https://github.com/damianjnc/forkifyApp
任何人都可以看到导致错误的原因以及如何调试它?
我可能记错了,但我感觉是这样的(在SearchView.js):
export const renderResults = recipes => {
recipes.forEach(renderRecipe);
};
应该像下面这样:
export const renderResults = recipes => {
recipes.forEach(recipe => renderRecipe(recipe));
};
如果有帮助,请告诉我。干杯!