1. 12
    Handle Actions in Redux with mapDispatchToProps
    2m 37s

Handle Actions in Redux with mapDispatchToProps

Andy Van Slaars
InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

We need to get our dispatch functions into our components in order to respond to events in Redux. Connect’s second argument is a function called mapDispatchToProps and it does exactly what the name implies. In this lesson, we’ll use this function to get our dispatch functions into our components via props and refactor to use these functions accordingly.

anna
anna
~ 3 years ago

why we have to import {updateCurrent} when the function is already receiving via props ?

ed leach
ed leach
~ 3 years ago

I'm just another student here, but I will give it a shot. You have to import the updateCurrent function to make it available to the App.js file. You then have to use it in bindActionCreators, mapDispatchToProps, and then connect to attach it as a prop to the App class component.