Incorrect sentence in `useSyncExternalStore`
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
The documentation of the subscribe argument of useSyncExternalStore states the following (emphasis mine):
subscribe: A function that takes a single callback argument and subscribes it to the store. When the store changes, it should invoke the provided callback. This will cause the component to re-render. The subscribe function should return a function that cleans up the subscription.
As far as I understand, it is not correct that invoking the callback will cause the component to re-render, it is only if the snapshot also changed that the component will re-render. Otherwise it would make a library like Redux unusable if every connected component re-rendered at every store change.
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
Beginne mit dem Abschnitt der React-Dokumentation zum subscribe-Argument von useSyncExternalStore und überprüfe das in der Issue beschriebene Callback- und Snapshot-Verhalten. Aktualisiere den ungenauen Satz so, dass er widerspiegelt, dass ein erneutes Rendern davon abhängt, ob sich der Snapshot ändert; die Aufgabe ist abgeschlossen, wenn die Dokumentation nicht mehr behauptet, dass jeder Aufruf des Callbacks die Komponente erneut rendert.
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
- 45/100