React components should be pure, not "idempotent"
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
Summary
A blogpost in the React docs confuses idempotence with purity. Even though this might seem a small typo, it is one of essential importance in that blogpost.
Page
https://react.dev/blog/2024/02/15/react-labs-what-we-have-been-working-on-february-2024
Details
Idempotence is a property of a function that it returns the same result if you apply the function twice to itself, for example, the absolute value function abs is idempotent, since, abs(abs(x)) = x. In general terms f : X --> X is idempotent iff f ∘ f = f.
This is confused with a pure function. This is a function that, given the same input, returns the same output. It is side-effect free or written in a "functional" style.
Even if this might seem like a minor mistake; it is one of the essential properties that the compiler should check for and to that extent, especially newer developers should not be confused.
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
Öffne den im Issue verlinkten Blogbeitrag von React Labs vom Februar 2024 und finde den Satz, der React-Komponenten als idempotent beschreibt. Überprüfe die umgebende Erklärung zur Reinheit, aktualisiere die Terminologie, damit die Seite die beabsichtigte Eigenschaft korrekt beschreibt, und überprüfe die gerenderte Dokumentation.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, react
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 1/5
- Geschätzter Aufwand
- Unter einer Stunde
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100