1<script type="text/babel">
2 var StateComponent = React.createClass({
3 resetName : function(event){
4 this.setState({
5 name : ''
6 });
7 },
8 render : function(){
9 return (
10 <div>
11 <input type="text" value= {this.state.name}/>
12 <button onClick={this.resetName}>Reset</button>
13 </div>
14 )
15 }
16 });
17 ReactDOM.render(<StateComponent/>, document.getElementById('app'));
18</script>
19