Q. How do you prevent a form submission from refreshing the page in React?

  • (A) By calling event.preventDefault() in the submit handler
  • (B) By using type='button' on the submit button
  • (C) By removing the form tag
  • (D) By using useState hook
πŸ’¬ Discuss
βœ… Correct Answer: (A) By calling event.preventDefault() in the submit handler
Explanation: Calling event.preventDefault() stops the default form submission behavior.
Explanation by: Mr. Dubey
Calling event.preventDefault() stops the default form submission behavior.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
81
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
95%
Success Rate