Refactoring to the Reducer Pattern
Let's start refactoring to the reducer pattern in this lesson.
We'll cover the following...
Current issues
While there’s a lot to like about the previous solution, it has a couple of issues that, while not necessarily a problem at this size, might become a problem if the code gets more complex. For example:
- Each individual action needs to know to call
calendarFilterChanged
to trigger a refresh. - The actual state is global and mutable, which means if some piece of code grabs the data and starts writing it, that change is made to everybody else, whether we want it to or not.
Refactoring
In order ...