Reducer Basics
Learn about the workings of a reducer.
We'll cover the following...
We'll cover the following...
At its most fundamental level, a reducer is simply a function that takes two arguments: the current state and an object representing an action that has occurred. The reducer returns the new state based on that action.
Working of reducer
The following code is regular JavaScript, but it could easily be converted to TypeScript by adding any types to state and action:
Let’s explain the code sample above: