showing results for - "code in nested foreach loop react native"
Alison
01 Feb 2017
1const nestedPromise = async (items = []) => {
2  return await Promise.all(
3    items.map(async item => {
4      if (Array.isArray(item) && item.length) {
5        return await nestedPromise(item)
6      }
7      // return await call to your function
8      return 'response-' + item
9    })
10  )
11}
12
13const items = [ [4, 1, 2], [2, 5] ]
14nestedPromise(items).then(results => {
15  console.log(results)
16})