Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

mapDispatchToProps in Redux

mapDispatchToPropsfunction is used to Dispatch Actions to the store in a react-redux application.
To Dispatch an action to the store we need to call store.dispatch. In a React Redux application the React component does not have access to the store directly hence it cannot call store.dispatch. The connect method which connects react and redux provides the mapDispatchToPropsthrough which react components can dispatch actions.

If mapDispatchToProps is not defined in connect, there is another way to dispatch actions from React components. In this case props.dispatch is passed to the component and using this we can dispatch actions to the store.



This post first appeared on C# Guide, please read the originial post: here

Share the post

mapDispatchToProps in Redux

×

Subscribe to C# Guide

Get updates delivered right to your inbox!

Thank you for your subscription

×