4 ms·
I think most UI components (like material-react) will break because ref now returns the dom object and not a reference to the component, or something along thos
by seivan 11y ago
I think most UI components (like material-react) will break because ref now returns the dom object and not a reference to the component, or something along those lines, correct me if I am wrong.
- spicyj 11y agoIn this release, we do patch .getDOMNode() onto DOM nodes that are returned as refs so this should continue to work. File an issue if it doesn't. If your code has no warnings in 0.13, you should be able to upgrade immediately, with the exception of the two minor breaking changes mentioned at the end of the "Breaking changes" section.
- mikewhy 11y agoSo: - 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.