question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Invariant Violation: ReactMount: Two valid but unequal nodes with the same `data-reactid`"

See original GitHub issue

I’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 samedata-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:

screen shot 2015-06-13 at 11 35 21

View of the same tree in the React plugin for Chrome:

screen shot 2015-06-13 at 11 34 37

Screenshot of the result

The blue element has nothing to do here

screen shot 2015-06-13 at 11 34 58

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
zpaocommented, Jun 13, 2015

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.

<a id="1">
  <a id="2">foo</a>
</a>

Will always get moved in the DOM to be

<a id="1"></a>
<a id="2">foo</a>

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 guess PluginsList 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.

0reactions
jimfbcommented, Aug 11, 2015

Oh, right, because the dom will rewrite the anchors. You’re right.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found