title: ReactJS - Need to click twice to set State and run function
body: <p>Here is a summary of the code I have inside my React component: </p>
  
  <pre><code>getInitialState: function(){
    return{link:""}
  },
  onClick1: function(){
     this.setState({link:"Link1"});
     this.otherFunction();
  },
  onClick2: function(){
     this.setState({link:"Link2"});
     this.otherFunction();
  },
  otherFunction:function(){
       //API call to this.state.link
  },
  render: function(){
    return &lt;div&gt;
    &lt;button1 onClick={this.onClick1}&gt;Link1&lt;/button&gt;
    &lt;button2 onClick={this.onClick2}&gt;Link2&lt;/button&gt;
    //...some code to display the results of API call
    &lt;/div&gt;
    }
  </code></pre>
  
  <p>The problem I have is that the first time I click the button, the otherFunction will run, but it will not have the updated value of myState. If I click a second time, then it works correctly. </p>