𝗥𝗲𝗮𝗰𝘁 𝗙𝗼𝗿𝗺𝘀 :
Just like in HTML, React uses forms to allow users to interact with the web page.
𝗦𝘂𝗯𝗺𝗶𝘁𝘁𝗶𝗻𝗴 𝗙𝗼𝗿𝗺𝘀
You can control the submit action by adding an event handler in the onSubmit attribute:
Why use event.preventDefault() or What is event.preventDefault() :
The Event.preventDefault method in React allows you to prevent the default behavior from occurring when an event gets fired off - this is going to change depending on the element and context. For example, when dealing with links (anchor elements), the default behavior would be to redirect to the URL, but with preventDefault() we are able to prevent this from happening.
From In React Part - 1: • Form in React js part - 1|| ReactJS T...
State in react functional component: • Learn useState in 8 minutes | ReactJS...
Event Handling In React: • Event Handling In React | Event Bindi...
Subscribe to our channel for more ReactJS tutorials: / @codingwithjeevan
/* External Links */
//_book
books you should read: https://amzn.to/3gyGNqn
//_electronics
Coder's mouse: https://amzn.to/3EWdnfu
Coder's Keyboard: https://amzn.to/3V1nRjf
Laptop: https://amzn.to/3GFdEEA
Headphones: https://amzn.to/3XqDulT
By: Jeevan Kumar | g1mishra