Skip to content

Update TodoForm to handle form submission correctly#190

Merged
royemosby merged 1 commit into
mainfrom
form-typo
May 24, 2026
Merged

Update TodoForm to handle form submission correctly#190
royemosby merged 1 commit into
mainfrom
form-typo

Conversation

@royemosby
Copy link
Copy Markdown
Collaborator

@royemosby royemosby commented May 24, 2026

This pull request makes a small but important improvement to the TodoForm component by ensuring that the handleAddTodo function is only triggered on form submission, rather than both on the form and button click. This prevents duplicate submissions and aligns with best practices for handling form events in React.

  • Updates to event handling:
    • Adds the onSubmit={handleAddTodo} handler to the <form> element and removes the onClick handler from the submit <button>, ensuring that the todo is added only once when the form is submitted. [1] [2]

Copilot AI review requested due to automatic review settings May 24, 2026 22:34
@royemosby royemosby merged commit bba12ff into main May 24, 2026
1 check failed
@royemosby royemosby deleted the form-typo branch May 24, 2026 22:34
@royemosby royemosby review requested due to automatic review settings May 24, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant