Document we should probably use React.memo under our Context Provider
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
It is not immediately obvious that when the component that declares the context provider re-renders, all its descendants will also render, and not just the components that subscribe to the context.
This has been made explicit by @sophiebits on Twitter: https://twitter.com/sophiebits/status/1228942768543686656, and @markerikson on his blog: https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/#context-updates-and-render-optimizations, but following the right people on twitter should not be a requirement to understand how React is supposed to be used.
While it's true that if one reasons about how React decides to render components (given one has a sufficient understanding of it) this behaviour can be inferred, I still think that an explicit recommendation would help a majority of React users.
Happy to try submitting a PR if needed :)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Es wird keine bestimmte Datei oder kein bestimmter Test genannt. Finde die Anleitung zum React Context Provider in der Dokumentation auf react.dev und prüfe die verlinkten Rendering-Referenzen; abgeschlossen ist die Aufgabe, wenn die Dokumentation klar erklärt, dass Nachkommen erneut gerendert werden, und die vorgesehene Empfehlung für React.memo nennt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- react
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100