Implementing the Add Course Reducer in React
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license

[00:00:00] Hi and welcome back to the react of course. Now that we have our course action and we are dispatching it let's go ahead and create the reducer for our course. So go ahead and head over to reducers slash courses. Yes. Let's just copy this entire case here. Of course the indentation and let's Name this course and make sure you're importing it here from actions and accident actions slash types. All right. So now that we have that soda let's go ahead and instead of changing it to falsa change it to true. And again like I said in a couple of guys a couple guides ago we could have just named something like handl coerce or something and have it just say correspondant all equals not horizontal. That way we don't have to type in to reducers into actions but just to keep things clear. I went ahead and said let's add in remove course and that course and just manually say true and false. So that's why we're doing that now. Let's go ahead and let's see if this is working. Should be working. Head over to the app and the browser and add and you'll notice it says remove and it's added to our schedule. Go ahead and remove them to see if this works. And it says rim of course is not defined. So let's go back in the code and see what's going on. But first let's add here it works. Remove it and we get the same error. So it says not remove courses is not defined in Horsell library digest. Let's go out and check why. [00:01:46][105.4]
[00:01:47] OK remove course. And it's because we haven't imported it up in here. So it has no idea what it is. So it's type interview of course and that should be gold. Let's check it out in the browser to remove and remove. OK. Awesome. That's working it's adding and removing it and it's showing and hiding it based on our enrolled status here and we should be good there in the next guide. Let's go ahead and set aside the react redux for a bit and let's get into some of the styles of the card here and then if we have time let's implement a button let's implement the functionality for Arrow and let's make it open and close. So let's go out and commit our code and I'll see you the next guy so get status and good command implemented producer for hard. Of course imported really of course. OK I was going to say any imported removed course action to our course library so we have access to it. But yeah. So I will see you in the next guide. [00:03:13][86.3]
[191.7]