For some reason, I'm not able to use React.findDOMNode function. Browser complains about type error, saying React.findDOMNode is not a function. This is the code where this happens:
var React = require('react');
var Backbone = require('backbone');
var Car = require('models/car');
var NewCarForm = React.createClass({
handleSubmit: function(e) {
e.preventDefault();
var brand = React.findDOMNode(this.refs.brand).value.trim();
...
this.props.handleNewCar(new Car({brand: brand, model:model, name:name, kmTraveled:odometer, litresSpent:litres}));
return;
},
render: function() {
console.log("Inside NewCarForm");
return (
<form className="contentSection" onSubmit={this.handleSubmit}>
<input type="text" placeholder="Car Brand" ref="brand" />
...
<input type="submit" value="Post" />
</form>
);
}
});
module.exports = NewCarForm;
This is the only module where I try to use this function. The rest of React works fine, so I have no idea what could be the problem here.