title: How to get axios.post info after click a button once
body: <p>When I want to get info from axios.post by clicking a button. But now I wanted to click the button twice to display the info. How should I do?</p>
  
  <pre><code>class ButtonComponent extends React.Component {
  state = {display:"ini"};
  rep = "ini";
  
  click() {
      var self = this;
      axios.post("url", {})
          .then((rep) =&gt; {
              self.rep = rep.data;
          })
          .catch((err) =&gt; {
              self.rep = err;
          }) 
      this.setState({
          display: this.rep
      });         
  }
  render() {
     return  (
      &lt;div&gt;
          &lt;button onClick={this.click.bind(this)}&gt; click me &lt;/button&gt;
          {this.state.display}
      &lt;/div&gt;
     );
     } 
    };
  </code></pre>