小编Fre*_*ddy的帖子

类型错误:传播不可迭代实例的尝试无效

编译到android并通过Store下载后,出现错误:

"TypeError: Invalid attempt to spread non-iterable instance"
Run Code Online (Sandbox Code Playgroud)

但是使用“react-native run-android”不会产生任何错误消息,因此我找不到调试它的好方法。

fetch(url)
  .then(response => response.json())
  .then(response => {
    if (this._mounted) {
      // let dataSource = this.state.articlesDataSource.cloneWithRows(response.data || [])
      //var rowCount = dataSource.getRowCount();
      var rowCount = Object.keys(response.data).length;

      if (refresh == true) {
        prevData = {};
      } else {
        prevData = this.state.articlesData;
      }
      if (propSearch == "" || propSearch == null) {
        newArticlesData = [...prevData, ...response.data];
      } else {
        newArticlesData = response.data;
      }
      if (response.meta.next_page != null) {
        var rowCount = true;
      } …
Run Code Online (Sandbox Code Playgroud)

javascript react-native react-native-android

12
推荐指数
2
解决办法
7万
查看次数