ComponentDidMount不使用此代码

问题描述 投票:-1回答:2

ComponentDidMount is not working with this code

当我检查使用chrome中的react插件时,没有得到阵列中的任何东西,请帮我弄清楚我错在哪里。我是reactjs的新手

reactjs react-dom
2个回答
3
投票

componentDidMount lifecycle function应该以小写字符开头,而不是大写字母。


1
投票

确保使用具有有状态组件而非功能组件的生命周期事件

接下来,应在render()之前定义生命周期定义

© www.soinside.com 2019 - 2024. All rights reserved.