Can the React docs state more rule of the custom Hook
- 主要言語
- 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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、https://reactjs.org/docs/hooks-custom.html のカスタム Hook のページと、関連する pull request #3557 を確認してください。状態の更新によって、カスタム Hook を使用するコンポーネントが再レンダーされるという意図した説明を確認し、その後、合意した文言または例でドキュメントを更新し、ページが正しくレンダーされることを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, react
- 領域
- documentation
- issue の種類
- ドキュメント
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100