submit messages on enter

This commit is contained in:
Gabriel mermelstein 2024-06-12 17:38:52 +02:00
parent 97f1ae78ff
commit 4a6d3bfe09
No known key found for this signature in database
GPG Key ID: 82B8134785FEAE0D

View File

@ -212,6 +212,13 @@ function App() {
}
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const checkForEnter = (e: any) => {
if (e.key === 'Enter') {
sendMessage()
}
}
const createUser = async () => {
try {
const name = await CreateUser(usernameInput);
@ -456,6 +463,7 @@ function App() {
<Input
value={newMessage}
onChange={updateMessage}
onKeyDown={checkForEnter}
placeholder="Input your message"
autoComplete="off"
autoCorrect="off"