[Suggestion]: improve <Form> documentation to explain how to keep form state after submission
未關閉
還沒有人認領這個 Issue。
type: documentation
- 主要語言
- JavaScript
- 星號
- 11.8k
- 分支
- 7.9k
- 平均合併
- 1 天 11 小時
- 30 天內合併 PR
- 11
描述
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.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 React 的
參考頁面開始,尤其是「Handling multiple submission types」範例,並檢視 issue #29034 及其連結的留言,了解 reset 行為和提議的替代方案。完成標準是:頁面清楚說明如何在提交後保留表單狀態,並包含一個經過同意且準確的範例,同時不認可不受支援的行為。由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript, react
- 領域
- documentation
- Issue 類型
- 文件
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100