ReactJS - ReactMount: The root element has been removed from the original container. New container

What does this error mean? How to fix it?

ReactMount: Root element has been removed from its original container. New container

After that, I get the following:

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

When I get these problems, I try to update my view with a new list of items. To update the current view, I call updatePosts ():

var updatePosts = function () {
    var content = document.querySelector('.content');
    content.innerHTML = '';
    $refresh.addClass('fa-spin');
    return React.renderComponent(
        <Posts />,
        content
    );
};

Could this problem be innerHTML = '? I will make my message component whole again.

+4
source share
1 answer

Delete this line

content.innerHTML = '';

React will look at the old virtual dom and what is coming back <Posts />(which is the same as Posts()). He will compare them and make updates necessary for the DOM.

+7
source

Source: https://habr.com/ru/post/1548634/


All Articles