State Management in Pure React, v2 Action & State Modification Exercise
This course has been updated! We now recommend you take the React Performance course.
Transcript from the "Action & State Modification Exercise" Lesson
>> What I'd love for you to do, is try to now dispatch an action when the forgiven checkbox has been checked. Right, so what's Forgiveness to actually doing the state management, to just announcing, hey, forgiveness has been issued. We have issued a pardon for whoever parts too close to me in the parking lot.
[00:00:23] It's not really that person's fault, it's the parking lot spaces, it's not important. We're gonna issue forgiveness to that person. We'll basically, instead of actually doing it all in there, we want to move it up into the reducer, and we want to just say that it happened. So we added the ability add a grudge, all right?
[00:01:09] I would implore you to do the same. Right, we'll get the idea in here, to do the same, to say, okay, a grudge has been forgiven, your job is to dispatch that announcement, right? And then in the reducer, which receives announcements like okay, if this is an announcement that a grudge has been forgiven, go ahead and we're gonna manage our state appropriately, right?
[00:01:31] And some of the inspiration of how to do this can be found right in here as well, like you'll have to do a little bit of change, right? Here we call it state, which we have it and we rename grudges, if you want, there's reasons why we might not want to later on.
[00:01:43] The same basic idea, just pull that through as well.