this.refs['hh']获取dom对象,this.refs['hh'].value获取dom对象的值
<div id="app"></div>
<script type="text/babel">
var App=React.createClass({
handle:function(e){
e.preventDefault()
console.log(this.refs['hh'].value)
},
render:function(){
return(
<form action="" onSubmit={this.handle}>
<input type="text" defaultValue="hjkhk" ref="hh"/>
<button type="onSubmit">提交</button>
</form>
)
}
});
ReactDOM.render(
<App/>,
document.getElementById("app")
)