---
title: "Discussion on \"Why Should You Use OnSubmit() Instead Of OnClick() Event Listener\" | Hashnode"
description: "Discussion on \"Why Should You Use OnSubmit() Instead Of OnClick() Event Listener\". Let's say this is my React form component:\nfunction Form() {\n  function handleSubmit(e) {\n    e.preventDefault();\n  }\n  return (\n    <form onSubmit={handleSubmit}>\n      <input type=\"text\" placeholder=\"Type anything...\"/>\n      <button>Submit</button..."
url: "https://hashnode.com/posts/why-should-you-use-onsubmit-instead-of-onclick-event-listener/64c7bef023f0761310fb7a9d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why Should You Use OnSubmit() Instead Of OnClick() Event Listener](https://wasimapinjari.hashnode.dev/why-should-you-use-onsubmit-instead-of-onclick-event-listener?utm_source=hashnode&utm_medium=feed)

Let's say this is my React form component: function Form() { function handleSubmit(e) { e.preventDefault(); } return ( <form onSubmit={handleSubmit}> <input type="text" placeholder="Type anything..."/> <button>Submit</button...

Jul 31, 2023 · 1 min read · wasimapinjari.hashnode.dev  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#tutorial](https://hashnode.com/tag/tutorial)
-   [#beginner](https://hashnode.com/tag/beginner)

## Written by

[Wasim A Pinjari](https://hashnode.com/@wasimapinjari)

@wasimapinjari · India

  
[View profile](https://hashnode.com/@wasimapinjari)

I am currently learning full-stack web development. I love the design aspect more so I am more of a frontend developer than a backend. And I am soon going to learn SVG animation as well. Yeh!

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
