Stuff React createComponent getInitialState function return value onCh

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
Stuff = React.createComponent({
getInitialState: function() {
return {value: ''};
},
onChange: function(e) {
this.setState({value: e.target.value});
},
onClick: function() {
this.props.callback(this.state.value);
},
render: function() {
return <div>
<input value={this.state.value} onChange={this.onChange}/>
<button onClick={this.onClick}/>
</div>;
}
});