老版本的react的写法:是通过class类组件的
import { Component } from 'react';
class Counter extends Component{state = {count: 0,}setCount = ()=>{this.setState({ count: this.state.count + 1 })}render(){return <button onClick={this.setCount}>{this.state.count}</button>}
}const App = () => {return (<div className="home"><Counter /></div>)
}
export default App