Skip to content

Instantly share code, notes, and snippets.

@matheusml
Created February 11, 2021 19:13
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 matheusml/02a7058164970b06591062ca5fdb108d to your computer and use it in GitHub Desktop.
Save matheusml/02a7058164970b06591062ca5fdb108d to your computer and use it in GitHub Desktop.
import React, { useState } from 'react';
function App() {
const [name, setName] = useState("");
const [email, setEmail] = useState("");
const onSubmit = () => {
// do something with `${name}` and `${email}`
};
return (
<form onSubmit={onSubmit}>
<label htmlFor="name">Name</label>
<input
name="name"
id="name"
value={name}
onChange={(e) => setName(e.target.value)}
/>
<label htmlFor="email">Email</label>
<input
type="email"
name="email"
id="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
<button type="submit">Submit</button>
</form>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment