title: Is this React and Axios then promise usage correct?
body: <p>I am using <code>axios</code> for a React project, and I was wondering if the usage of <code>then</code> promise is correct in this case.<br>
  Basically, I use <code>axios</code> to fetch data from the database when the component renders.   </p>
  
  <pre><code>class Participants extends React.Component{
      constructor(props){
          super(props);
  
          this.state = {
              databaseUsers: [],
          }
  
          this.getUsers = this.getUsers.bind(this);
  
      }
  
      getUsers(){
          var users = axios.get('/users/get-users').then((response) =&gt; {
              this.setState({databaseUsers: response.data});
          });
      }
  
      componentWillMount(){
          this.getUsers();
      }
  
      render(){
          console.log(this.state.databaseUsers);
          return(** html tree **);
  
      }
  }   
  </code></pre>
  
  <p>What I observe is that the state of the component is set twice, once when the rendering occurs, and the <code>then</code> promise fires, and a second time when the promise is done fetching the data from the database and sets the <code>state</code>.<br>
  How do I get more control over this? Like actually wait for the data on the database, and then render?<br>
  Any tips are welcome. </p>