Redux store changes but component does not get rendered ,when user login and we are returned back to product component Redux store does not update component and its props
class Product extends React.Component {
onClickAdd(){
if(!user) {
this.props.navigation.navigate('login')
return;
}
this.addTaskTocart()
}
render() {
return ()
}
}
const mapStateToProps = (state) => {
const { cart } = state;
return { cart: cart }
};
const mapDispacthToProps = dispatch => {
return {
getCartItems: () => dispatch(getCartItems())
};
}
export default connect(mapStateToProps, mapDispacthToProps)(Product)