1、react当中事件绑定不准确的解决办法。
class LoggingButton extends React.Component { handleClick() { console.log(‘this is:‘, this); } render() { // 这个语法确保了 `this` 绑定在 handleClick 中 return ( <button onClick={(e) => this.handleClick(e)}> Click me </button> ); } }
原文:https://www.cnblogs.com/yuanjili666/p/11637353.html