reactjs / reactjs/react.dev

[Suggestion]: improve <Form> documentation to explain how to keep form state after submission

オープン
#8,397 コメント 1 件 リアクション 7 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

type: documentation
主要言語
JavaScript
スター
11.8k
フォーク
7.9k
平均マージ
1日 11時間
マージ済み PR(30日)
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:

  1. Add a deep dive on when to use onSubmit vs action props.
  2. 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.
  3. Update the Handling multiple submission types example so that the "Save draft" button will keep the text of the form.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

React の

リファレンスページから始め、特に「Handling multiple submission types」の例を確認し、reset の動作と提案されている回避策について issue #29034 とリンク先のコメントを調査します。ページで送信後にフォームの状態を保持する方法が明確に説明され、サポートされていない動作を推奨せず、合意された正確な例が含まれていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, react
領域
documentation
issue の種類
ドキュメント
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。