Reactjs 调用API数据时如何使用异步?

Reactjs 调用API数据时如何使用异步?,reactjs,async.js,Reactjs,Async.js,这是我的源代码,我循环数组包括乘法 import request from 'superagent'; import waterfall from 'async-es/waterfall'; import async from 'async-es'; let total_arr = []; for (i = 0; i < range.values.length; i++) { self.getDataServiceGoogle( r

这是我的源代码,我循环数组包括乘法

    import request from 'superagent';
    import waterfall from 'async-es/waterfall';
    import async from 'async-es';
    let total_arr = [];
    for (i = 0; i < range.values.length; i++) {

        self.getDataServiceGoogle( range[i] ,function(response){   

          /// response is an array
             total_arr.push(response);

        });

      }
  }
}
我必须异步处理这种情况。有人有办法吗 帮我一下。我从不使用异步。
P/s:reactjs写的

如果self.getDataServiceGoogle可以返回一个承诺,你可以为I的每个值创建一个承诺数组,然后使用Thank@fzxt。我试试看
 total_arr = [
       response_1,
       response_2,
       response_3,
       response_4,
       ..........,
       response_n
   ]