reactjs / reactjs/react.dev

Why don't we mention the concept of callBack props in the 'Lifting State Up' page?

Offen
#5,306 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
JavaScript
Sterne
11.8k
Forks
7.9k
Ø Merge
1 T. 11 Std.
Gemergte PRs (30 T.)
11

Beschreibung

There are times the source of the detailed or complete data is best isolated in a child component rather than trying to lift the state up and creating large parent component. The large parent component that has all the state, goes against the concepts of code isolation and separation of concerns,

Given this, why not add a note to https://reactjs.org/docs/lifting-state-up.html that talks about callback props?
There are 3 issues i'm aware of with callback props:

  1. that warning that the parent component is still rendering: solution: launch the event handler code asynchronously
    2): In async functions, after await(), we should check whether the component is still mounted.
    3): whenever a function is passed as a prop it must be frozen and then only added to the useEffect() dependency chain (better to add all dependencies for useEffect rather than ignore the warning)

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Seite „Lifting State Up“ unter reactjs.org/docs/lifting-state-up.html und überprüfe, wie sich callback props auf deren Empfehlungen beziehen. Bewerte die drei im Issue aufgeführten Bedenken und ermittle, ob eine sachlich korrekte Anmerkung auf die Seite gehört. Als erledigt gilt die Aufgabe, wenn die Dokumentation eine klare, technisch fundierte Erklärung enthält oder der vorgeschlagene Zusatz des Issues mit Begründung abgelehnt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, react
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.