title: API call in render method in React inside map
body: <p>I have a <code>userId</code> array and I need to show the list of names related to that array. I want to call API call inside the <code>render</code> method and get the username. But this is not working. How can I fix this issue?</p>
  <p>Below is my <code>render</code> method:</p>
  <pre><code>render(){
      ...
      return(
          &lt;div&gt;
              {this.state.users.map(userId =&gt; {
                  return (
                      &lt;div&gt; {this.renderName(userId )} &lt;/div&gt;
                  )
              })}
          &lt;/div&gt;
      )
      ...
  }
  </code></pre>
  <p>Below is the <code>renderName</code> function:</p>
  <pre><code>renderName = (userId) =&gt; {
      axios.get(backendURI.url + '/users/getUserName/' + userId)
           .then(res =&gt; &lt;div&gt;{res.data.name}&lt;/div&gt;)
  }
  </code></pre>