在react中获取真实dom的时候就需要用到ref属性,具体使用如下
var MyComponent = React.createClass({handleClick: function() {console.log(this.input)},render: function() {return (<div><input type="text" ref={(input) => {this.input = input}} /><input type="button" value="Focus the text input" onClick={this.handleClick} /></div> );} });ReactDOM.render(<MyComponent />,document.getElementById('example') );