Closed karudo closed 8 years ago
I've never seen findDOMNode
return null
unless there's an error in your rendering. The render
function must ALWAYS return an element, so every component must had a DOM node.
My suspicion is that your DOM tree is being modified by the browser, which would normally cause an invariant violation as well. See here: http://stackoverflow.com/questions/25026399/uncaught-error-invariant-violation-findcomponentroot-110-unable-to
In any case, I need an easily reproducible example in order to be able to fix anything. findDOMNode
always returns a value for valid React trees.
Not a bug in rquery
, from what I can tell.
Why the render
function must ALWAYS return an element?
The documentation says that the render
function may return null
You can also return
null
orfalse
to indicate that you don't want anything rendered. Behind the scenes, React renders a<noscript>
tag to work with our current diffing algorithm. When returningnull
orfalse
,ReactDOM.findDOMNode(this)
will returnnull
.
Hmm, I had missed that change in the React spec. In previous versions render
was definitely required to return something.
Fix released as version 4.3.0. Hopefully that works for you. Thanks for the bug report!
Yes, its works for me. Thank you!
I have error in my test
I did some research and came to the conclusion that the cause is component Collapse from react-bootstrap ReactDOM.findDOMNode() for this component returns null, because the component have not any dom node.