Código em Nested foreach loop- react nativo

const nestedPromise = async (items = []) => {
  return await Promise.all(
    items.map(async item => {
      if (Array.isArray(item) && item.length) {
        return await nestedPromise(item)
      }
      // return await call to your function
      return 'response-' + item
    })
  )
}

const items = [ [4, 1, 2], [2, 5] ]
nestedPromise(items).then(results => {
  console.log(results)
})
ldhoang