Skip to content

Instantly share code, notes, and snippets.

@wdchris
Last active May 18, 2020 17:28
Show Gist options
  • Save wdchris/36a4a327ed83983eeaef6855d99fbbe8 to your computer and use it in GitHub Desktop.
Save wdchris/36a4a327ed83983eeaef6855d99fbbe8 to your computer and use it in GitHub Desktop.
const [email, setEmail] = useState("")
const handleSubmit = e => {
fetch("/", {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: formEncode({ "form-name": "register", email: email }),
})
.then(() => alert("Success!"))
.catch(error => alert(error))
e.preventDefault()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment