class LoggingButton extends React.Component {
constructor() {
super();
this.handleClick = this.handleClick.bind(this);
}
handleClick () {
console.log('this is:', this);
}
render() {
return (
<button onClick={this.handleClick}>
Click me
</button>
);
}
}
React—事件
猜你喜欢
转载自blog.csdn.net/Poppy_LYT/article/details/100702195
今日推荐
周排行