title: React: 'this.state' is undefined inside a component function
body: <p>I'm having trouble accessing <code>this.state</code> in functions inside my component. I already found <a href="https://stackoverflow.com/questions/33973648/react-this-is-undefined-inside-a-component-function">this</a> question on SO and added the suggested code to my constructor:</p>
  
  <pre><code>class Game extends React.Component {
  
    constructor(props){
      super(props);
      ...
      this.state = {uid: '', currentTable : '', currentRound : 10, deck : sortedDeck};
      this.dealNewHand = this.dealNewHand.bind(this);
      this.getCardsForRound = this.getCardsForRound.bind(this);
      this.shuffle = this.shuffle.bind(this);
    }
  
    // error thrown in this function
    dealNewHand(){
      var allCardsForThisRound = this.getCardsForRound(this.state.currentRound); 
    }
  
    getCardsForRound(cardsPerPerson){
      var shuffledDeck = this.shuffle(sortedDeck);
      var cardsForThisRound = [];
      for(var i = 0; i &lt; cardsPerPerson * 4; i++){
        cardsForThisRound.push(shuffledDeck[i]);
      }
      return cardsForThisRound;
    }
  
    shuffle(array) {
      ...
    }
  
    ...
    ...
  </code></pre>
  
  <p>It still does not work. <code>this.state.currentRound</code> is undefined. What is the problem?</p>