popcodeorg / popcodeorg/popcode
Implement reducers with handleActions
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 191
- Forks
- 143
- Ø Merge
- 4 T. 11 Std.
- Gemergte PRs (30 T.)
- 5
Beschreibung
Currently most of our reducers are implemented as a big switch statement, which is unwieldy and hard to read. Instead, use the handleActions() helper in redux-actions to implement the reducer as a map of action names to reducer functions.
We should follow the pattern of using the action creator function itself as the map key, allowing us to avoid hard-coding string literals containing the action name.
See the console reducer for an example of the desired implementation.
Testing
Since our goal here is merely to refactor the reducers, not change their behavior, all existing tests should pass after a reducer is refactored.
However, it might make sense to also port the reducer test to Jest after completing the refactor and confirming that the old tests pass with the new reducer implementation (this should be in separate commits).
Reducers to migrate
-
clients -
compiledProjects -
console -
currentProject -
errors -
googleClassroom -
index -
projects -
resizableFlex -
ui -
user
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
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 abgeschlossenen Beispiel in src/reducers/console.js, suche dann die noch nicht überprüften Reducer clients, compiledProjects, currentProject, errors, googleClassroom, index, projects und user. Refaktoriere sie mit redux-actions, wobei das Verhalten erhalten bleibt, und führe alle vorhandenen Tests aus, um zu bestätigen, dass sie weiterhin bestehen; überlasse die Portierung der Jest-Tests einer separaten Änderung.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, redux
- Bereich
- frontend
- Issue-Typ
- Refactoring
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100