title: what is right way to do API call in react js?
body: <p>I have recently moved from Angular to ReactJs. I am using jQuery for API calls. I have an API which returns a random user list that is to be printed in a list.</p>
  
  <p>I am not sure how to write my API calls. What is best practice for this?</p>
  
  <p>I tried the following but I am not getting any output. I am open to implementing alternative API libraries if necessary.</p>
  
  <p><strong>Below is my code:</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>import React from 'react';
  
  export default class UserList extends React.Component {    
    constructor(props) {
      super(props);
      this.state = {
        person: []
      };
    }
  
    UserList(){
      return $.getJSON('https://randomuser.me/api/')
      .then(function(data) {
        return data.results;
      });
    }
  
    render() {
      this.UserList().then(function(res){
        this.state = {person: res};
      });
      return (
        &lt;div id="layout-content" className="layout-content-wrapper"&gt;
          &lt;div className="panel-list"&gt;
            {this.state.person.map((item, i) =&gt;{
              return(
                &lt;h1&gt;{item.name.first}&lt;/h1&gt;
                &lt;span&gt;{item.cell}, {item.email}&lt;/span&gt;
              )
            })}
          &lt;div&gt;
        &lt;/div&gt;
      )
    }
  }
  </code></pre>