Created
September 11, 2018 01:53
-
-
Save yomete/cb18ccc7cf78701f1bf88837973d70f9 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
class CustomTextInput extends React.Component<{}> { | |
handleSubmit = e => { | |
e.preventDefault(); | |
console.log(this.textInput); | |
}; | |
// tell Flow that we want to associate the textInput ref | |
// with an HTML Input button | |
textInput: ?HTMLInputElement; | |
render() { | |
return ( | |
<div> | |
<form onSubmit={e => this.handleSubmit(e)}> | |
<input type="text" ref={textInput => (this.textInput = textInput)} /> | |
<button>Submit</button> | |
</form> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment