1。学习非受控组件的用法

class CustomTextInput extends React.Component{
constructor(props){
super(props);
this.handleSubmit=this.handleSubmit.bind(this);
}

handleSubmit(e){
e.preventDefault();
const val=this.refs.name;
const dom=findDOMNode(val);//通过findDOMNode来获取dom结点
console.log(dom.value);
}

render(){
return (
<div>
<form onSubmit={this.handleSubmit}>
<input type="text" defaultValue="I am the default value" ref="name"/>
<button type="submit">click me to submit</button>
</form>
</div>
)
;
}
}