reactjs / reactjs/react.dev

Can the React docs state more rule of the custom Hook

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

@KennethKinLum がすでに取り組んでいます。

2021年3月2日 から。

  • #3557 @KennethKinLum による — オープン
主要言語
JavaScript
スター
11.8k
フォーク
7.9k
平均マージ
1日 11時間
マージ済み PR(30日)
11

説明

Could the custom Hook page https://reactjs.org/docs/hooks-custom.html
include one important rule:

https://github.com/reactjs/reactjs.org/pull/3557

Does any change of state in a custom Hook cause any component that uses it to re-render? Yes, when we use any Hook in our function, this function becomes a custom Hook, and when other components use it, any update of the state in this custom hook can cause the component to re-render. So we should not think of the custom Hook as a static function.

Or something along that line? Right now, it feels really magically that somehow, we define a function and it can magically cause another component to re-render itself.

A working example might even be added: https://codesandbox.io/s/suspicious-keller-blqey?file=/src/App.js

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

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

はじめの一歩

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

調査の方向性

まず、https://reactjs.org/docs/hooks-custom.html のカスタム Hook のページと、関連する pull request #3557 を確認してください。状態の更新によって、カスタム Hook を使用するコンポーネントが再レンダーされるという意図した説明を確認し、その後、合意した文言または例でドキュメントを更新し、ページが正しくレンダーされることを確認してください。

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

評価

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

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

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