![](/img/trans.png)
[英]I'm getting this error “TypeError: Cannot read property 'map' of undefined” on my React project
[英]I get the error : Cannot read property 'then' of undefined when I run my react project
我得到錯誤:
無法讀取未定義的屬性“then”
當我運行我的反應項目時,代碼如下
getQuestions = () => {
quickService().then(question => {
this.setState({
questionBank: question
});
});
};
您收到此錯誤是因為您的 quickService() function 不返回 promise,因此您不能使用.then() 或.catch()。 我認為您應該首先閱讀 Javascript 中的 Promise 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.