第二章, 在子控件按钮回调时,直接传入变化值1或-1,逻辑简单很多?
XiaoYaoDaddy opened this issue · comments
Evangeline Lee commented
onClickIncrementButton() {
this.updateCount(1);
}
onClickDecrementButton() {
this.updateCount(-1);
}
updateCount(changeValue) {
this.setState({count: this.state.count + changeValue})
this.props.onUpdate(changeValue)
}