Hands-on practice for this lecture. Write the code, see it run, understand the pattern.
Exercise 1 of 2
Deposit $100 — balance never changes, no error. There is a typo in the action creator type string. Find it, introduce constants, and fix the silent bug.
Task
Click Deposit $100. The balance does not change. No error in the console either — the action dispatches silently and hits the default case.
Open App.js, find the typo in the action creator, then fix it using constants so the same string is shared between the creator and the reducer.
deposit()const DEPOSIT = 'DEPOSIT' and const WITHDRAW = 'WITHDRAW'case labelsExercise 2 of 2
Live editor: write action type constants, action creator functions, and a subscribe callback for a quiz score tracker. Three steps, one working Redux app.
Task — three steps
ANSWER_CORRECT and ANSWER_WRONG as action type constantsanswerCorrect(points) and answerWrong(points) action creatorsstore.subscribe() before the dispatches to log the score after each changeThe dispatches below use your action creators. The UI should show score=25, correct=2, wrong=1.