LoginSignup
2
4

More than 3 years have passed since last update.

mapの中でawaitを使う方法

Posted at

本当にただのメモですが、、

const list = await Promise.all(listA.map(async itemA => {
  return { ...itemA, ...await this.getListB(itemA.id) }
}));

ただawait書くだけではエラーになりますが、Promise.allを使えば良いそうです。

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4