Skip to content

Instantly share code, notes, and snippets.

@yomete
Created September 11, 2018 02:03
Show Gist options
  • Save yomete/a8ec3247566c778e2ab98ff5140fccfc to your computer and use it in GitHub Desktop.
Save yomete/a8ec3247566c778e2ab98ff5140fccfc to your computer and use it in GitHub Desktop.
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)}>
<textarea 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