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.

Cryptic error message for findDOMNode of unmounted component

See original GitHub issue

As per https://github.com/facebook/react/issues/2410#issuecomment-115659185: findDOMNode(this) throws for unmounted components, but the error message is too cryptic:

Uncaught Error: Invariant Violation: Component (with keys: getDOMNode,_handleChange,props,context,state,refs,_reactInternalInstance) contains render method but is not mounted in the DOM

Some expert React users honestly thought they had duplicate React or something, so didn’t even bother to check whether the component was mounted. (It wasn’t.)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
percyhannacommented, Apr 1, 2016

For any who may happen to run across this same error in the future, I recently saw this error which was caused by calling getDOMNode() on a component that had been unmounted. This was caused by an asynchronous event that then assumed the component was still mounted. Although isMounted is considered an anti-pattern, this is one possible use case that I see it being very convenient for.

0reactions
gaearoncommented, Apr 1, 2016

This was on an app that hasn’t gotten around to upgrading past 0.13.x yet.

Got it, thanks. I was just worried we missed some case when adding a warning.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React 16: Error: Unable to find node on an unmounted ...
Based on the error message, I believe the error is happening when calling ReactDOM.findDOMNode(this) in the handleClickOutside(event) method.
Read more >
Blog | React - GitHub Pages
findDOMNode (see below). If your components are currently using .getDOMNode() , they will continue to work with a warning until 0.15.
Read more >
Getting rid of findDOMNode in your React application - Medium
This ReactDOM method allows us to access the underlying DOM node of a component. As we can see, findDOMNode is deprecated in StrictMode....
Read more >
Getting large cryptic errors and warnings when trying to use ...
Coding example for the question Getting large cryptic errors and warnings when trying to use mongoose with webpack-Reactjs.
Read more >
find_element_by_tag_name is deprecated - You.com | The AI ...
Previously, runtime errors used to put React into a broken state and produce cryptic errors. React 16 fixes this by introducing a special...
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