获取DOM的真实节点

<script type="text/babel">
var Myelement=React.createClass({
handleClick:function(){
this.refs.myInput.focus();  this.refs.[refname]获取真实的节点 只有真实的DOM发生click事件之后 才会发生this.refs.myInput
},
render:function(){
return (
<div>
<input type="text" ref="myInput" />
<input type="button" value="focus" onclick={this.handleClick} /> 
</div>
);
}
});

ReactDOM.render(
<Myelement/>,
document.getElementById('example')
);

</script>

Myelement组件是封装起来,具有获取真实DOM节点功能的组件

原文地址:https://www.cnblogs.com/Litter-Tulip/p/5588314.html