AsyncStorage Done() 调用 [英] AsyncStorage Done() Call

查看:61
本文介绍了AsyncStorage Done() 调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在 AsyncStorage 调用之后 done() 是什么,我也可以在 catch() 之后调用它吗?如果我不调用 done() 会发生什么?

I wonder what is done() after AsyncStorage call and can I call it after catch() too? What will happen if I don't call done()?

 AsyncStorage.getItem('vehicle')
             .then(json => {})
             .done();

推荐答案

正如我从评论和博客中了解到的.

As I understand from the comments and blogs I got it.

如果您将在 AsyncStorage 中使用 AsyncStorage,您应该在外部 Promise 上调用 done() 以便您可以捕获嵌套 AsyncStorage 错误.

If you will use AsyncStorage inside AsyncStorage you should call done() on the outer Promise so you can catch the nested AsyncStorage errors.

这篇关于AsyncStorage Done() 调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆