Adding Types to the Reducer
Learn how to add types to the reducer and make constants of type names.
Implementing types in the reducer
Adding TypeScript will protect us from some of the more obvious mistakes—by ensuring we both pass in the correct arguments and return the expected result. Both situations can be tricky to triage in our applications because they might not happen until after the user takes an action—like clicking a button in the UI. Let’s quickly add some types to our reducer:
Get hands-on with 1300+ tech skills courses.