Javascript Can';t在未安装的组件上调用setState(或forceUpdate)。这是一个no-op,但它表示应用程序中存在内存泄漏,有人知道吗?

Javascript Can';t在未安装的组件上调用setState(或forceUpdate)。这是一个no-op,但它表示应用程序中存在内存泄漏,有人知道吗?,javascript,node.js,reactjs,react-native,vue.js,Javascript,Node.js,Reactjs,React Native,Vue.js,我想在页面中显示列表,但我仍然混淆了使用componentDidMount和componentWillMount,我得到了以下错误: 无法对未安装的组件调用setState(或forceUpdate)。这是一个no-op,但它表示应用程序中存在内存泄漏。要修复此问题,请取消componentWillUnmount方法中的所有订阅和异步任务。 在文章中(由LatestNews创建) 在div中(由最新新闻创建) 在div中(由最新新闻创建) 从“React”导入React; 从“../../ap

我想在页面中显示列表,但我仍然混淆了使用componentDidMount和componentWillMount,我得到了以下错误: 无法对未安装的组件调用setState(或forceUpdate)。这是一个no-op,但它表示应用程序中存在内存泄漏。要修复此问题,请取消componentWillUnmount方法中的所有订阅和异步任务。 在文章中(由LatestNews创建) 在div中(由最新新闻创建) 在div中(由最新新闻创建)

从“React”导入React;
从“../../api/article”导入api;
类文章扩展了React.Component{
建造师(道具){
超级(道具)
此.state={
第[…]条,
isMounted:错误
}
}
componentDidMount(){
this.timer=setInterval(()=>this.setState({isMounted:true},()=>{
如果(此.state.isMounted){
this.setState({isMounted:false});
{
//做点什么
//这个.props.onClick(…)
}
}
}), 5000);
}
组件willmount(){
clearInterval(这个.timer)
api.getArticles()
.然后(文章=>{
console.log(文章)
this.setState({articles:articles.article})
})
.catch(err=>console.log(err))
}
render(){
console.log('render disii')
返回(
{this.state.articles.map((新闻,i)=>{
返回(
{news.tittle}
{news.content}

今天 {this.formatDate(news.created)} 聊天泡泡提纲 ); })}; ); }; }
出口违约物品我想这就是您的答案。您是否要删除呈现
文章的父组件中的组件?它很可能是在异步操作完成之前卸载的。