Skip to content

Add guidance on preventing form reset in React - #8406

Closed
nikhilkumar5177 wants to merge 1 commit into
reactjs:mainfrom
nikhilkumar5177:patch-2
Closed

nikhilkumar5177 wants to merge 1 commit into
reactjs:mainfrom
nikhilkumar5177:patch-2

Conversation

@nikhilkumar5177

Copy link
Copy Markdown

Summary

Adds documentation explaining how to prevent automatic form reset when using the action prop.

Changes

  • Added a new section: "Preventing unwanted form reset"
  • Explained default reset behavior of uncontrolled inputs
  • Included example using controlled inputs with onSubmit

Why

Forms using the action prop reset uncontrolled fields after submission. This behavior may be unexpected and can cause confusion. This update clarifies how developers can preserve form state.

Notes

  • No breaking changes
  • Follows existing documentation style

Added section on preventing unwanted form reset during submission. Included example using React state and event.preventDefault().
@nikhilkumar5177

Copy link
Copy Markdown
Author

Looks like the Vercel preview failed. Let me know if I should fix anything on my side.

@aurorascharff

Copy link
Copy Markdown
Collaborator

Thanks for the contribution! #8512 has been merged and addresses these concerns. If you have further suggestions, please open a new PR and tag me and I’ll take a look!

This branch had an error being deployed

1 failed deployment
Preview — 79b7bad6 Deployed Apr 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants