Created
December 17, 2015 06:50
-
-
Save apotonick/7cf3ce67d0e67772ff77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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