2 ms·
From what Dan Abramov has been posting on Twitter recently, findDOMNode() is in the process of being deprecated, so rather than writing const component = R
by pietro 10y ago
From what Dan Abramov has been posting on Twitter recently, findDOMNode() is in the process of being deprecated, so rather than writing
const component = ReactDOM.findDOMNode(TestUtils.renderIntoDocument(
<MyComponent {...props} />
));
we should be writing
let node;
const component = TestUtils.renderIntoDocument(
<MyComponent {...props} ref={n => node = n}/>
);
https://gist.github.com/gaearon/7f0e03d3028016bfabfad641720d3de1 https://gist.github.com/gaearon/7f0e03d3028016bfabfad641720d...
- jfdk 10y agoGood to know, will update the examples when I have time. Not sure I'm a big fan of it though, doesn't seem as clear to a React noob what is going on with ref?
- deleted 10y ago[deleted]