Hacker News new | ask | show | jobs
by joesb 4000 days ago
Aren't these two changes in conflict with each other?

One change remove assumption about DOM as rendered target, while another change means DOM must be the rendered target.

Requiring ReacDOM.findDOMNode(ref) should be what they do if they want to encourage multiple rendering target.

1 comments

If you use a ref to a DOM component, you don't need ReactDOM.findDOMNode at all. Calling findDOMNode on a composite drills through abstraction boundaries and breaks encapsulation, so it's rarely what you should do.

The removal of .getDOMNode() was intentionally done in concert with this change: previously, all component classes created with React would magically have that DOM-specific method added to them; this way, component classes are less tied to specific rendering environments. If you need to call ReactDOM.findDOMNode then yes, your components will be tied to the ReactDOM renderer.