Redux Fundamentals (feat. React) Connect API & mapDispatchToProps Exercise
Transcript from the "Connect API & mapDispatchToProps Exercise" Lesson
>> I got the forum working your job is going to look at the individual menu item, I swapped out menu items writ large and the new menu item form. Your job is to create a container For the individual menu item, and then we're gonna pass it the ability to remove a individual item from the menu.
[00:00:28] Now one thing that I will kinda give you a hint Because this is a little bit trickier, than just taking props and dispatching them. One thing that I will say is not only we kinda go back a little bit, not only is dispatch passed in, but we have this own props as a second argument.
[00:00:47] Own props is going to be cool. We have the State and the dispatcher were mapping to props. But in case other things were passed into this component, you have access to those as well. So own props, I definitely console log and see what it is for yourself. But we can make a hypothesis around what is going to be, right?
[00:01:06] If you look at the menu items, we're taking all the different properties of the item including its ID. So if you need to figure out how to remove a given one from state, You'll have that on the own props object. So your job is to basically we need an action.
[00:01:21] We need the reducer logic, we need to wrap the menu item and then we need to pass in that property. As the removed prop that is going to then fire the action and remove it from our store. So why don't we spend 10 minutes and see if we can wire up the ability to remove a menu item from the menu, and then we'll do it together as a team