title: Can't access values for Axios calls in map loop
body: <p>I have a javascript object with the IDs corresponding to a set of galleries.
  I loop through it using map.
  On each loop, I make an axios call to get the gallery for the current id.</p>
  
  <p>In the end, I need to have an array with all the galleries content.</p>
  
  <p>The problem is I can't access the data after the map loop is done. I see all the data when I console.log(galleries) but not when I do console.log(galleries[0].gallery).</p>
  
  <p>I suspect this has to be with the async calls.
  I'm new to react so I'm might be missing something simple.</p>
  
  <p>Extra info: this is a React Native project, with redux thunk.</p>
  
  <p>Help please and thank you.</p>
  
  <pre><code>export function FetchGalleries( galleries_ids ) {
  
      return function (dispatch) {
  
          let galleries = [];
          galleries_ids.map( (record, index) =&gt;
          {
  
              axios.get('https://e.dgyd.com.ar/wp-json/wp/v2/media?_embed&amp;parent='+record.id)
                .then(response =&gt; {
                  galleries.push( response );
                });
  
          });
  
          console.log(galleries); // I can see all data
          console.log( JSON.parse(JSON.stringify( galleries[0].gallery ))); // returns undefined
          dispatch({ type: FETCH_GALLERIES_SUCCESS, payload: galleries })
  
        }
  }
  </code></pre>