Skip to content

Instantly share code, notes, and snippets.

@EQuimper
Created January 18, 2017 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EQuimper/cfd276829a7ef9f78d0b698215380994 to your computer and use it in GitHub Desktop.
Save EQuimper/cfd276829a7ef9f78d0b698215380994 to your computer and use it in GitHub Desktop.
Using ref in functional component
function CustomForm ({handleSubmit}) {
let inputElement
return (
<form onSubmit={() => handleSubmit(inputElement.value)}>
<input
type='text'
ref={(input) => inputElement = input} />
<button type='submit'>Submit</button>
</form>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment