react使用变量声明方式如何设置this.state以及componentDidMount

https://img3.mukewang.com/5bef8641000185a903270183.jpg

我知道通过Class创建的组件可以在super后设置this.state,以及使用componentDidMount函数,但是对于这种变量声明类的又该怎么去使用react的this.state和生命周期函数呢

精慕HU
浏览 950回答 1
1回答

饮歌长啸

你这本身就是无状态函数组件, 要使用生命周期就别写这种组件
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript