import React, { Component } from 'react'

export default class home extends Component {
    constructor(props) {
        super(props)
        this.state = {
            count: 0
        }
    }
    handleAdd = () => {
        this.setState({
            count: this.state.count + 1
        })
    }

    handleClick() {
        this.setState({
            count: this.state.count + 1
        })
    }
    render() {
        return (
            <div>
                <button onClick={this.handleAdd}>不使用bind</button>
                <button onClick={this.handleClick.bind(this)}>使用bind</button>
                {this.state.count}
            </div>
        )
    }
}

Lifelong learning lifelong benefit