reactjs / reactjs/react.dev

[Suggestion]: Add some elaboration to the docs for TypeScript DOM events and Pure Functions

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

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

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

説明

Summary

The Section on DOM events in the page Using TypeScript, mentions extracting functions, this can be elaborated further to include the case where we do get the types i.e. inline methods.

The section on Pure Functions contain a example of Teacups and guests, the global let guests variable should be incremented by 1, but is incremented by 2. Since, React is running in StrictMode for development, this might be confusing for newbies. Found here: https://react.dev/learn/keeping-components-pure#side-effects-unintended-consequences
Edit: The deep dive for this chapter contains the explanation.

Page

https://react.dev/learn/keeping-components-pure

Details

Add another small example where it shows that we do get types when using inline methods, to make it more clear.

Either turn off Strict mode for this example OR explain why we are getting 2, 4, 6 instead of the expected 1, 2, 3 because of React.StrictMode.

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

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

はじめの一歩

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

調査の方向性

リンク先の keeping-components-pure ページと Using TypeScript セクションを開き、関数の抽出に関する DOM イベントの説明を見つけてください。イベントの型が推論されることを示す、小さなインラインメソッドの例を追加し、初めての人にも説明が明確か確認してください。

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

評価

技術スタック
react, typescript
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
50/100

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

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