[Suggestion]: improve <Form> documentation to explain how to keep form state after submission
Aperta
Nessuno ha ancora preso questa issue.
type: documentation
- Lingua principale
- JavaScript
- Stelle
- 11.8k
- Fork
- 7.9k
- Merge medio
- 1g 11h
- PR unite (30g)
- 11
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dalla pagina di riferimento di React su
, in particolare dall’esempio “Handling multiple submission types”, e esamina la issue #29034 e il commento collegato riguardo al comportamento di reset e alle soluzioni alternative proposte. Il lavoro è completato quando la pagina spiega chiaramente come preservare lo stato del modulo dopo l’invio e include un esempio concordato e accurato, senza promuovere un comportamento non supportato.Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, react
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100