【发布时间】:2020-09-03 02:54:38
【问题描述】:
我试图在渲染函数中获取并有一个 then 函数来做一些事情。我的代码如下。但是,它似乎从来没有调用过 then 函数。
获取(网址,{ 方法:“获取”, 标头:{ 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': "*", "Cache-Control": "no-store" }, 正文:空 }) .then(function (res) {console.log("here");finished++}) .catch(function (err) {console.log(err)});
而(完成
我尝试向传递给 then 函数的函数添加不同数量的参数。我也尝试过添加 finally 块。 cmets显示异步调用成功并成功返回,所以我无法理解问题所在。任何帮助将不胜感激。
【问题讨论】:
标签: reactjs api asynchronous fetch