Hacker News new | ask | show | jobs
by pietro 3631 days 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/7f0e03d3028016bfabfad641720d...
1 comments

Good 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?