A section quite vague
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, react
- Ambito
- documentation
Direzione di ricerca
Inizia leggendo la sezione “Passing Handlers as Alternative to Propagation” all’URL collegato della documentazione di React e confrontala con il materiale circostante sulla gestione degli eventi. Rivedi la spiegazione con un esempio specifico che chiarisca lo scopo, il comportamento del genitore e la catena di esecuzione, quindi verifica che le affermazioni astratte citate siano comprensibili per chi è alle prime armi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
In https://react.dev/learn/responding-to-events#passing-handlers-as-alternative-to-propagation
You could add more code to this handler before calling the parent onClick event handler, too. This pattern provides an alternative to propagation. It lets the child component handle the event, while also letting the parent component specify some additional behavior. Unlike propagation, it’s not automatic. But the benefit of this pattern is that you can clearly follow the whole chain of code that executes as a result of some event.
If you rely on propagation and it’s difficult to trace which handlers execute and why, try this approach instead.
It is somewhat abstract what it is talking about. "You could add more code" -- add more code for what purpose?
"This pattern provides an alternative to propagation" alternative to propagation? Why do I need to rely on propagation in the first place? (and such that I now need an "alternative"?)
"while also letting the parent component specify some additional behavior." What additional behavior?
"But the benefit of this pattern is that you can clearly follow the whole chain of code that executes as a result of some event." Follow the chain? What do you mean?
"If you rely on propagation and it’s difficult to trace which handlers execute and why, try this approach instead." What approach? Why do we "rely on propagation" in the first place?
Can you talk about something specific. Perhaps using an example with specific things. Right now it is quite abstract.
- Lingua principale
- JavaScript
- Stelle
- 11.8k
- Fork
- 7.9k
- Merge medio
- 16h 6m
- PR unite (30g)
- 7
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di reactjs/react.dev
-
type: documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
-
bug: unconfirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
type: typos
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
bug: unconfirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100