title: Reactjs : setState doesn't assign value to state
body: <p>I need help, and you are the only ones to give me that :D
  I'm learning reactjs, trying to develop a simple fight game.</p>
  
  <p>I try to update one state (on the line below) to define whose turn to give a hit it is:</p>
  
  <p><em>this.setState({whoseRound: rand}, console.log('test:' + this.state.whoseRound))</em></p>
  
  <p>and it won't update my state. My state value still is 0. I can't understand why, if someone could save me !</p>
  
  <p>thanks to everyone.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>class App extends Component {
  
    constructor(props) {
      super(props);
      this.state = {
        characters: [], //contains Array of characters objects
        readyToFight: false, // character selected or not
        firstPlayerCharacter: null, //contains key of character on select
        secndPlayerCharacter: null, //contains key of character on select
        whoseRound: 0 // defines whose character attacks
      }
    }
  
    //Run the fight
    setFight = () =&gt; {
      let firstFighter = this.state.characters[this.state.firstPlayerCharacter]
      let secndFighter = this.state.characters[this.state.secndPlayerCharacter]
  
      this.initiateFight(firstFighter, secndFighter);
    }
  
    //initiate fight rounds
    initiateFight = (firstFighter, secndFighter) =&gt; {
  
      // set who attacks first randomly =&gt; returns 1 or 2
      var rand = randomDice(1, 2)
  
      // !!!!! HERE: My console.log always display 0
      this.setState({whoseRound: rand}, console.log('test:' + this.state.whoseRound))
  
      while(firstFighter.stats.health &gt; 0 || secndFighter.stats.healthh &gt; 0){
        // depending on whoseRound is, we set an attacker and a defenser
        1 === this.state.whoseRound ? this.runRound(firstFighter, secndFighter) : this.runRound(secndFighter, firstFighter)
      }
    }
  
    // Lance les actions définies pour un round
    runRound = (attacker, defender) =&gt; {
      let hit = false
      let cc = false
      let damages
  
      hit = randomDice(0, 100) &lt;= this.getHitChances(attacker, defender)
      cc = randomDice(0, 100) &lt;= this.getCriticalChances(attacker, defender)
      damages = this.getDamages(attacker, defender, cc)
  
      if(hit)
      {
        //console.log(attacker.name + ' attaque ' + defender.name + ' et lui occtroie ' + damages + ' points de dégats')
        //console.log('les points de vie de ' + defender.name + ' passent de ' + defender.stats.health + ' à ' + (defender.stats.health - damages))
        defender.stats.health -= damages
      }
  
      //Now, it's the other character's turn
      1 === this.state.whoseRound ? this.setState({whoseRound: 2}) : this.setState({whoseRound: 1})
  
    }
    
  }
  
  export default App;</code></pre>
  </div>
  </div>
  </p>