DEV Community

Discussion on: Building Shopping Cart Actions and Reducers with Redux

Collapse
 
alirasapour profile image
Ali Rasapour

how to use in mapDispatchToProps ??
Please Help.

Collapse
 
monmohon profile image
Mon Mohon Singha

mapDispatchToProps is dead
use hook

Collapse
 
edizle585 profile image
Elijah Logan

Import Connect from react-redux in files that contain components you want to connect to the store
Use Connect function to connect component to redux store
Use mapStateToProps to pass down store state through props

const mapStateToProps = state => {
return {
products: state.products
}
}

export default connect( mapStateToProps )( Cart );

Here is what my store looks like that's passed the Reducer
const initialState = {
products: [],
};

I hope this helps!