reactjs / reactjs/react.dev

Hooks docs: Props usage isn't obvious

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

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

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

説明

Seen this a few times as a bit of a common theme in Reactiflux's #need-help channel. New Hooks users (with only minimal prior React experience) are hitting the Hooks docs, and having some success using basic hooks (e.g., useState), but are missing how "hook components" consume props.

I think there's a bit of an issue of "hook components" not necessarily being recognized as "function components", or users not being familiar with function components to start with.

Looking at the first two pages of hooks docs, we get to the fourth example component before any props are used. I'm (unfortunately) guessing that users aren't reading solidly to that point to see the example.

Proposed solution

Could the intro page's example include using props? Or perhaps a second intro page example which does. I think it needs to be pretty early in the new user's reading flow, before they attempt to write their own component, and before they jump to reading the later pages.

Long term solution

At the moment, I think a large contributing factor is that the Hooks documentation is still mostly standalone from the rest of the docs. I think the combination of newness wearing off, and integration into the "main" docs will eventually solve this problem.

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

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

はじめの一歩

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

調査の方向性

Hooks ドキュメントの最初の 2 ページを確認し、特に導入例と、props が初めて登場する 4 番目のサンプルコンポーネントを重点的に確認してください。初期の導入例を更新するか、2 つ目の例を追加して、props を使用する hook コンポーネントを示し、新しい読者にその使い方が明確に伝わるようにしてください。

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

評価

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

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

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