react的componentDidMount()函数报错missing semicolon,如何解决,完整代码如下
function Article() {
loadList = async () => {
const res = await axios.get('http://159.75.234.216:8888/alldata')
console.log(res)
}
componentDidMount() {
this.loadList()
}
return (
<div>1</div>
)
}
export default Article
报错如下:
SyntaxError: E:\code\web\src\pages\Article\index.js: Missing semicolon. (77:23)
75 | }
76 |
77 | componentDidMount() {
| ^
78 | this.loadList()
79 | }
80 | }