title: React async API call inside .map() function from actions
body: <p>I am new to React JS. In my application I am facing a situation where I need to call an API multiple times with different url, like apiurl.com/abc, apiurl.com/xyz. These abc and xyz are stored in an array. Hence I wanted to use .map() to change the url to make multiple api calls. But in .map() async await wont work, so looking for some solutions if any. I have gone through few possible solution like with promises, but could not implement.</p>
  <p>Here is my code:</p>
  <pre><code>export const someAction = () =&gt; async (dispatch, param) =&gt; {
  let myArray = [&quot;abc&quot;, &quot;xyz&quot;];
  let id= &quot;&quot;;
  param1 = &quot;someauthcode&quot;;
  myArray.map((x) =&gt; {
      id = x;
      const myResponse = await loaders.myResponseApi(param1, id); *//This does not work as await should be in async call*
  });
  dispatch({ type: types.ARRAY_API, payload: myResponse });
  </code></pre>
  <p>}</p>
  <p>So the idea is to make 2 api calls with apiurl.com/abc, apiurl.com/xyz. I have constructed the url (apiurl.com) in an different file.</p>
  <p>Thanks in advance.</p>