[Suggestion]: improve <Form> documentation to explain how to keep form state after submission
Offen
Dieses Issue hat noch niemand übernommen.
type: documentation
- Vorherrschende Sprache
- JavaScript
- Sterne
- 11.8k
- Forks
- 7.9k
- Ø Merge
- 1 T. 11 Std.
- Gemergte PRs (30 T.)
- 11
Beschreibung
Summary
https://github.com/facebook/react/issues/29034 raises concerns about actions resetting forms. There are many use cases where developers would want to prevent the form from resetting. Since React's behavior is not expected to change, the docs should explain to users how to control form resets and preserve the form's previous state.
Page
https://react.dev/reference/react-dom/components/form
Details
I do not know the best way to provide this information. Some suggestions include:
- Add a deep dive on when to use onSubmit vs action props.
- Include an example of opting out of automatic resets using an example based on @eps1lon comment here: https://github.com/facebook/react/issues/29034#issuecomment-2143595195. The issue has several other workarounds that may or may not be endorsed by the Rect team.
- Update the Handling multiple submission types example so that the "Save draft" button will keep the text of the form.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der React-Referenzseite zu
, insbesondere mit dem Beispiel „Handling multiple submission types“, und prüfe Issue #29034 sowie den verlinkten Kommentar zum Reset-Verhalten und zu den vorgeschlagenen Workarounds. Als erledigt gilt die Aufgabe, wenn die Seite klar erklärt, wie der Formularzustand nach dem Absenden erhalten bleibt, und ein abgestimmtes, korrektes Beispiel enthält, ohne nicht unterstütztes Verhalten zu empfehlen.Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, react
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100