(React)生命周期方法

2021-04-12  本文已影响0人  fanren
class App extends Component {

  constructor(props) {
    super(props)
    console.log('constructor')
  }

  componentDidMount() {
    console.log('componentDidMount')
  }

  componentWillUnmount() {
    console.log('componentWillUnmount')
  }

  respondsToClick(title, e) {
    console.log(this)
    console.log(title)
    console.log(e)
  }
  render() {
    return (
      <div className="App">
        <div>aaaa</div>
        <a onClick={(e) => this.respondsToClick('addd', e)}>点击增加</a>
      </div>
    );
  }
}
export default App;

生命周期方法详解

上一篇下一篇

猜你喜欢

热点阅读