reactjs / reactjs/react.dev

Hooks docs: Props usage isn't obvious

Aperta
#1,775 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
JavaScript
Stelle
11.8k
Fork
7.9k
Merge medio
1g 11h
PR unite (30g)
11

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Esamina le prime due pagine della documentazione di Hooks, in particolare gli esempi introduttivi e il quarto componente di esempio, in cui props compaiono per la prima volta. Aggiorna un esempio introduttivo iniziale, oppure aggiungine un secondo, in modo che dimostri un componente hook che utilizza props e renda chiaro l’utilizzo ai nuovi lettori.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, react
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.