4 ms·
So: - a `ref` of your own component will be the component instance, complete with `getDOMNode` - a `ref` of React.DOM will be the DOM node Just seems weirdly
by mikewhy 11y ago
So:
- a `ref` of your own component will be the component instance, complete with `getDOMNode`
- a `ref` of React.DOM will be the DOM node
Just seems weirdly confusing.
- daveidol 11y agoIf I understand spicyj correctly, I think he's saying in v0.14 a ref of React.DOM will now be the raw DOM node; but it will also contain a getDOMNode method (which just returns itself) in order to continue working for people expecting the old behavior. Refs to custom components will work exactly how they did in 0.13. And getDOMNode is deprecated in general (use React.findDOMNode instead).
- spicyj 11y agoThat's right. In almost all cases you should just use a ref now and not call findDOMNode except as an upgrade path, because findDOMNode breaks encapsulation when used on other components.