Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第二章, 在子控件按钮回调时,直接传入变化值1或-1,逻辑简单很多? #96

Open
XiaoYaoDaddy opened this issue May 24, 2018 · 0 comments

Comments

@XiaoYaoDaddy
Copy link

XiaoYaoDaddy commented May 24, 2018

  onClickIncrementButton() {
    this.updateCount(1);
  }

  onClickDecrementButton() {
    this.updateCount(-1);
  }

  updateCount(changeValue) {
    this.setState({count: this.state.count + changeValue})
    this.props.onUpdate(changeValue)
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant