If you have used VUE, you will know that vUE’s event binding is very simple. However, react’s event binding is a bit different from vUE’s. So let’s compare

React event binding
class Title extends Component {
  handleClickOnTitle () {
    console.log('Click on title.')
  }

  render () {
    return (
      <h1 onClick={this.handleClickOnTitle.bind(this)}>The React little book</h1>)}}// VUE event binding
 <h1 @click="handleClickOnTitle"</h1> methods: {handleClickOnTitle(){
    console.log('Click on title.')}}Copy the code

The React event binding is quite different from vue. The event binding uses onClick and must be named with a hump. Because the render function uses some mechanism to distinguish between javascript methods or CSS and HTML tags at compile time, it is easy to compile. The method must be wrapped in {}, because it is a variable, without which an error will be reported. Did you quit school