I am trying to get the Enter key to submit this form but it is refreshing the page instead. Any Solutions?
<form onSubmit={() => handleSubmit()}> <label for="text">Enter Task</label> <input type="text" id="name" value = {input} onInput = {(e) => setInput(e.target.value)}></input> <button type = "submit">Add</button> </form> This is my handleSubmit() function:
const handleSubmit = e => { e.preventDefault() //function logic I have tried using the preventDefault() function but that does not seem to work
onSubmituseonClick.