这个问题的关键在于bind(),React编译后渲染部分和逻辑部分是分开的,需要绑定上下文
参考 React and ES6 - Part 3, Binding to methods of React class (ES7 included)
常见方法:
1.
//handle
click(event, arg1, ...) {
//code
}
<button
onClick={(event) => {this.click(event, arg1, ...)}}
>Button</button>
//handle
click(arg1, ..., event) {
//code
}
<button
onClick={this.click.bind(this, arg1, ...)}
>Button</button>