"Invariant Violation: ReactMount: Two valid but unequal nodes with the same `data-reactid`"
See original GitHub issueI’m trying to display a dropdown menu composed of ul
, li
and a
(similar to the one from bootstrap).
A PluginList
element is used to generate a dropdown menu from a store.
But the browser is not correctly parsing/outputting the HTML. Everytime I click on an item, I got the error: Uncaught Error: Invariant Violation: ReactMount: Two valid but unequal nodes with the same
data-reactid: .0.0.0.0.7.1.$=15:0.0
.
This bug is probably related to #1400, but I can’t find any solution 😓
I’using react 0.13.3 and I also tested with the latest master.
HTML DOM View:
View of the same tree in the React plugin for Chrome:
Screenshot of the result
The blue element has nothing to do here
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Invariant Violation: ReactMount: Two valid but unequal nodes ...
I know that is an issue. Can someone give me the solution for it? Maybe create new another element in "contenteditable" mode, or...
Read more >HTML : Reactjs : Invariant Violation: ReactMount: Two valid but ...
HTML : Reactjs : Invariant Violation: ReactMount: Two valid but unequal nodes with the same `data-reactid`: .0.5 [ Beautify Your Computer : https://www.hows ......
Read more >Error: Invariant Violation: ReactMount: Two valid but unequal nodes ...
Error: Invariant Violation: ReactMount: Two valid but unequal nodes with the same `data-reactid`
Read more >Invariant Violation: ReactMount: Two valid but unequal nodes ...
Coding example for the question Reactjs : Invariant Violation: ReactMount: Two valid but unequal nodes with the same `data-reactid`: .0.5-Reactjs.
Read more >etsy/hound - Gitter
(and after a couple of searches: Uncaught Error: Invariant Violation: ReactMount: Two valid but unequal nodes with the same `data-reactid`: .0.1.0 ).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Looking at the HTML view, the data-reactid in question is used on 2
<a>
tags. Usually this is the result of the browser reorganizing nodes, specifically nested<a>
s.Will always get moved in the DOM to be
That’s the likely culprit for your case. Chances are you have nested anchors across components.
DropdownItem
definitely has one. If anything rendered inside there has an anchor (I guessPluginsList
or one of its children), then this will happen. When it does happen, React’s idea of the DOM and the real DOM get out of sync, and then you hit this problem.Though your problem might actually be manifesting slightly differently (could be the DOM structure playing different tricks) but you definitely have nested anchors.
Oh, right, because the dom will rewrite the anchors. You’re right.