Submit form when enter key is clicked

This commit is contained in:
Chigozirim Igweamaka 2024-05-15 04:54:09 +01:00
parent d569471334
commit 1006112acb

View file

@ -36,7 +36,7 @@ const Form = ({ socket }) => {
const { spotifyUrl } = formState; const { spotifyUrl } = formState;
return ( return (
<form className={styles.Form}> <form className={styles.Form} onSubmit={submitForm}>
<div style={{ flexGrow: 1 }}> <div style={{ flexGrow: 1 }}>
<div>Add songs to the server</div> <div>Add songs to the server</div>
<input <input
@ -48,7 +48,7 @@ const Form = ({ socket }) => {
onChange={handleChange} onChange={handleChange}
/> />
</div> </div>
<input type="button" value="Submit" onClick={submitForm} /> <input type="submit" value="Submit" onClick={submitForm} />
</form> </form>
); );
}; };