Is ReactDOM.findDOMNode necessary with refs

I’m going through the latest Simple-Todos React tutorial to get up to speed on 1.3. To get the value of a text field, the section 4.2 code uses:

const text = ReactDOM.findDOMNode(this.refs.textInput).value.trim();

Is findDOMNode really necessary? Can’t you just use:

const text = this.refs.textInput.value.trim();

It’s not necessary! Just an oversight in the tutorial. Unfortunately the tutorial is a bit hard to update (as a tradeoff for being correct and having a follow-along git repo) so I’m not sure if it’s worth it to fix this in the short term.

In terms of learning new stuff, I find following along with a tutorial to be the easiest.

When I started Meteor 6 months ago, Discover Meteor helped me understand more than any other resource, but it’s outdated now.

You’ve done a fantastic job on the guide and it’s an invaluable resource. I think a comprehensive React tutorial similar to Discovery Meteor would greatly compliment it.


eslint-plugin-react now shows an error when findDOMNode is used.

1 Like