Open Lanttcat opened 5 years ago
先抛出来一个demo
// After click, show number should be 3 class App extends React.Component { state = { total: 0 } handle = () => { this.setState({ total: 2 }); } testFunc = (param) => { const nu = param || this.state.total; return nu + 1; } render() { return ( <div className="App"> <h1 onClick={this.handle}>Hello CodeSandbox</h1> <h2>{this.testFunc()}</h2> </div> ); } }```
先抛出来一个demo