Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ReactJS-ReactMount:根元素已从其原始容器中移除。新容器_Javascript_Reactjs - Fatal编程技术网

Javascript ReactJS-ReactMount:根元素已从其原始容器中移除。新容器

Javascript ReactJS-ReactMount:根元素已从其原始容器中移除。新容器,javascript,reactjs,Javascript,Reactjs,这个错误意味着什么?如何解决这个问题 ReactMount: Root element has been removed from its original container. New container 在这之后,我得到: Uncaught object react.js:15915 invariant react.js:15915 ReactMount.findComponentRoot react.js:10584 ReactMount.findReactNodeByID react.

这个错误意味着什么?如何解决这个问题

ReactMount: Root element has been removed from its original container. New container
在这之后,我得到:

Uncaught object react.js:15915
invariant react.js:15915
ReactMount.findComponentRoot react.js:10584
ReactMount.findReactNodeByID react.js:10480
getNode react.js:10089
(anonymous function) react.js:7307
(anonymous function) react.js:11403
processQueue react.js:10856
ReactMultiChild.Mixin.updateChildren react.js:10970
ReactDOMComponent.Mixin._updateDOMChildren react.js:7007
(anonymous function) react.js:6860
(anonymous function) react.js:11403
ReactComponent.Mixin._performUpdateIfNecessary react.js:4409
ReactComponent.Mixin.receiveComponent react.js:4380
ReactDOMComponent.Mixin.receiveComponent react.js:6833
(anonymous function) react.js:5963
(anonymous function) react.js:11403
ReactCompositeComponentMixin._performComponentUpdate react.js:5899
ReactCompositeComponentMixin._performUpdateIfNecessary react.js:5842
Mixin.perform react.js:14266
ReactComponent.Mixin.performUpdateIfNecessary react.js:4390
ReactCompositeComponentMixin.performUpdateIfNecessary react.js:5792
enqueueUpdate react.js:12731
ReactCompositeComponentMixin.replaceState react.js:5676
ReactCompositeComponentMixin.setState react.js:5655
(anonymous function) posts.js:273
j jquery-1.11.1.min.js:2
k.fireWith jquery-1.11.1.min.js:2
x jquery-1.11.1.min.js:4
b
当我遇到这些问题时,我会尝试用一个新的项目列表更新我的视图。要更新当前视图,我调用updatePosts():

var updatePosts=函数(){
var content=document.querySelector('.content');
content.innerHTML='';
$refresh.addClass('fa-spin');
返回React.renderComponent(
,
内容
);
};
这个innerHTML=''可能是问题所在吗?我将再次呈现完整的帖子组件。

删除此行

content.innerHTML = '';

React将查看旧的虚拟dom,以及
返回的内容(与
Posts()
相同)。它将比较它们,并对DOM进行所需的更新。

为什么要将innerhtml设置为空?React已经在处理DOM manips了
content.innerHTML = '';