Last active
August 29, 2015 14:17
-
-
Save tomatau/1f32c147bb95be27fae0 to your computer and use it in GitHub Desktop.
Component Refs
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
let MyForm = React.createClass({ | |
render(){ | |
return ( | |
<form onSubmit={this.handleSubmit}> | |
<input type="text" ref='my-input' /> | |
</form> | |
) | |
}, | |
handleSubmit(event){ | |
event.preventDefault() | |
let myInputRef = this.refs['my-input']; | |
let myInputNode = React.findDOMNode(myInputRef) | |
console.log(myInputNode) | |
let inputValue = myInputNode.value; | |
console.log(inputValue) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment