请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

报一个警告

Warning: Can’t call setState on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to this.state directly or define a state = {}; class property with the desired state in the TodoList component.

正在回答 回答被采纳积分+3

1回答

Dell 2021-04-26 22:48:10

代码发上来看一下

0 回复 有任何疑惑可以回复我~
  • 提问者 shyqnuaa #1
    找到原因了,之前根据老师的代码 store.subscribe(this.handleStoreChange)//监听
    这个方法写在constructor里,就会报这个错;
    将这个方法挪到componentDidMount里,就没有这个错了,跟生命周期有关系吧?
    回复 有任何疑惑可以回复我~ 2021-04-28 10:54:31
  • Dell 回复 提问者 shyqnuaa #2
    是的!不要写在constructor中
    回复 有任何疑惑可以回复我~ 2021-05-01 21:04:25
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号