title: How do I console.log a changed state in React?
body: <p>I'm new to React and am working on someone else's code (thrown in the deep end).</p>
  
  <p>There is a simple button has a <code>handleClick()</code> handler. I want to increment a specific state by 1.</p>
  
  <p>To that effect I have tried:</p>
  
  <pre><code>state = {
    page: 0,
  }
  
    handleClick() {
  
      this.setState(state =&gt; ({
        page: state.page + 1
      }))
  
      console.log(page)
    }
  </code></pre>
  
  <p>but this just produces a <code>page is not defined</code> error.</p>
  
  <p>I've tried various combinations of the above, eg <code>console.log(state.page)</code>, <code>page: page + 1</code>, etc but don't get any results.</p>
  
  <p>Would anyone know how I could console log to test if the state is updating?</p>