将React Native集成到现有项目后,如何处理iOS和Android本机代码中的一些意外错误?
例如,React Native视图无法访问网络或出现错误。
谢谢!
答案 0 :(得分:0)
至少对于网络错误(假设你正在使用FETCH api),你可以添加一个' catch'并显示警告/做其他事情:
fetch('/some/url', {
method: 'get'
}).then(function(response) {
}).catch(function(err) {
// Error :(
});