在 React 中,我试图让按钮增加存储在状态中的值。但是,在使用 handleClick 时,使用下面的函数代码,我的值设置为 undefined 或 NaN。
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) => {
    this.setState({value: prevState.value + 1});
    console.log(this.state.value)
  }
你能告诉我为什么会这样吗?根据此处的文档,它应该是正确的:https : //facebook.github.io/react/docs/state-and-lifecycle.html