Created
January 27, 2021 15:44
-
-
Save luistak/e40c2f0d173bf44fe85276dfffcc5025 to your computer and use it in GitHub Desktop.
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
function App({ onNewMessage }) { | |
const handleSubmit = (e) => { | |
e.preventDefault(); | |
const { target: form } = e; | |
const input = form?.elements?.something; | |
const customEvent = new CustomEvent('message', { detail: input.value }); | |
window.dispatchEvent(customEvent) | |
form.reset(); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment