![](/img/trans.png)
[英]connect react redux HOC got error of `Cannot call a class as a function`
[英]got that error on react project that connect to github
CORS 政策已阻止從源“http://localhost:3000”獲取“http://dataservice.accuweather.com/currentconditions/v1/[object%20Promise]?apikey=4k4wWlScDkI28jEhjxoniSZCvJgYkbZW”的訪問權限:否“訪問” -Control-Allow-Origin' header 存在於請求的資源上。 如果不透明的響應滿足您的需求,請將請求的模式設置為“no-cors”以獲取禁用 CORS 的資源。
這里有多個問題:
await
關鍵字或.then()
最后,CORS 標頭設置不正確,在您的獲取選項中,您可以添加 header: Access-Control-Allow-Origin: http://localhost:3000
請注意,您必須在投入生產時更新原點。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.