title: Issue accessing state inside setInterval in React.js
body: <p>I am trying to access the state of a component inside a <code>setInterval</code> in this way but it's not working:</p>
  
  <pre><code>componentDidMount: function() {
      setInterval(function() {
        console.log(this.state);
      }, 3000);
  }
  </code></pre>
  
  <p>However, if I place the callback function in a separate component method, it works perfectly:</p>
  
  <pre><code>displayState: function() {
    console.log(this.state)
  }
  componentDidMount: function() {
      setInterval(this.displayState(), 3000);
  }
  </code></pre>
  
  <p>Any idea why is this happening? I would prefer to use the first option.</p>