Skip to content

Instantly share code, notes, and snippets.

@apotonick
Created December 17, 2015 06:50
Show Gist options
  • Save apotonick/7cf3ce67d0e67772ff77 to your computer and use it in GitHub Desktop.
Save apotonick/7cf3ce67d0e67772ff77 to your computer and use it in GitHub Desktop.
var NewInput = React.createClass() {
getInitialState: function() {
return {
value: 'Hello!',
othervalue: this.props.othervalue
};
},
handleChange: function(event) {
this.setState({value: event.target.value});
},
render: function() {
var value = this.state.value;
return <div>
<span>{this.props.othervalue}</span>
<input type="text" value={value} onChange={this.handleChange} />
</div>
}
}
var OtherInput = React.createClass() {
render: function() {
<NewInput othervalue={'something'}> /* NewInput.new(othervalue: 'something') */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment