Created
April 9, 2019 13:35
-
-
Save joaocarvalhowd/a97e64820bb71fe0b527c46b7b51549d to your computer and use it in GitHub Desktop.
Get value
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
import React, { useRef } from "react"; | |
import { | |
AppBar, Typography, Toolbar, TextField | |
} from "@material-ui/core"; | |
function App() { | |
const fields = { | |
name: useRef(), | |
github: useRef(), | |
linkedin: useRef(), | |
website: useRef() | |
}; | |
const handleSubmit = e => { | |
e.preventDefault(); | |
const data = { | |
name: fields.name.current.value, | |
github: fields.github.current.value, | |
linkedin: fields.linkedin.current.value, | |
website: fields.website.current.value | |
}; | |
}; | |
return ( | |
<> | |
<AppBar position="static" color="default"> | |
<Toolbar> | |
<Typography variant="h6" color="inherit"> | |
Performance Form | |
</Typography> | |
</Toolbar> | |
</AppBar> | |
<form onSubmit={handleSubmit}> | |
<TextField | |
ref={fields.name} | |
label="Name:" | |
fullWidth | |
/> | |
<TextField | |
ref={fields.github} | |
label="Github:" | |
fullWidth | |
/> | |
<TextField | |
ref={fields.linkedin} | |
label="Linkedin:" | |
fullWidth | |
/> | |
<TextField | |
ref={fields.website} | |
label="Website:" | |
fullWidth | |
/> | |
</form> | |
</> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment