title: Incrementing state value by one using React
body: <p>In React I am trying to make a button increment a value stored in state.
  However using the code below function my value is set undefined or NaN when using handleClick. </p>
  
  <pre><code>class QuestionList extends React.Component {
    constructor(props) {
      super(props);
      this.state = {value: 0};
  
      // This binding is necessary to make `this` work in the callback
      this.handleClick = this.handleClick.bind(this);
    }
  
     handleClick = (prevState) =&gt; {
      this.setState({value: prevState.value + 1});
      console.log(this.state.value)
    }
  </code></pre>
  
  <p>Can you tell me why this is happening? it should be correct according to the docs here:
  <a href="https://facebook.github.io/react/docs/state-and-lifecycle.html" rel="noreferrer">https://facebook.github.io/react/docs/state-and-lifecycle.html</a></p>