Here is a summary of the code I have inside my React component:
getInitialState: function(){
return{link:\"\"}
},
onClick1: function(){
this.setState({
From the docs:
setState()does not immediately mutatethis.statebut creates a pending state transition. Accessingthis.stateafter calling this method can potentially return the existing value.There is no guarantee of synchronous operation of calls to
setStateand calls may be batched for performance gains.
If you want a function to execute after the state transition completes, pass it in as a callback:
onClick1: function() {
this.setState({link:"Link1"}, this.otherFunction);
},