Creating a Reducer

Learn to create a reducer.

We'll cover the following

Reducer

A reducer is a function that will make the necessary changes to the state. It takes in the current state and the action being processed as parameters and returns the new state. In this section, we are going to implement a reducer. Let’s perform the following steps:

  1. One of the parameters in the reducer is the action that invoked the state change. Let’s create a union type containing all the action types that will represent the reducer action parameter:

Get hands-on with 1200+ tech skills courses.