javascript - React Native 最终无法识别
问题描述
finally 关键字在经典的 es6 helloworld 获取示例中未定义。
let isLoading = true;
fetch("https://jsfiddle.net").then(function(response) {
var contentType = response.headers.get("content-type");
if(contentType && contentType.includes("application/json")) {
return response.json();
}
throw new TypeError("Oops, we haven't got JSON!");
})
.then(function(json) { /* process your JSON further */ })
.catch(function(error) { console.error(error); /* this line can also throw, e.g. when console = {} */ })
.finally(function() { isLoading = false; console.log("done")});
解决方案
推荐阅读
- typescript - 有没有办法让 keyof 在打字稿中处理高阶类型?
- python-3.x - 有没有办法将奇数长度的十六进制字符串转换为字节数组,或者 python 3.8 中是否存在奇数长度的字节数组
- php - 在 WooCommerce 中为每 10 个订单设置自定义运费
- node.js - 节点 express console.log(req.body) 在 post 请求中为空
- python - 我如何获得这个圆圈上红色像素和白色块像素的坐标?
- java - 为什么我的 Thymeleaf 只显示列表的最后一行
- python - 将时间戳转换为日期时间错误的 AM/PM
- apache-flink - k8s上的flink缺少状态值-在jobmanager / taskmanager崩溃时恢复作业
- oracle - 在 pyspark 的 oracle 查询中使用参数
- javascript - 从 React 中的 API 调用收到状态 404 后,如何重定向到错误页面?