Answer the question
In order to leave comments, you need to log in
How to pass a function to react redux?
I am trying to pass a function to another component via
export default connect(mapStateToProps, mapDispatchToProps)(ProductFooter)
const mapDispatchToProps = dispatch => ({
getReviews: () => dispatch(actions.getReviews.fetch.start(paginationResult)),
getReviewsFilter: () => dispatch(actions.getReviewsFilter.fetch.start(params[0], params[1])),
});
export default connect(mapStateToProps, mapDispatchToProps)(ProductFooter) // именно этот коннект не работает
export const ProductFooter = ({getReviews }) => {
console.log(getReviews());
return (
<div>
</div>
)
};
<Review item={item} key={item.id} getReviews={props.getReviews} />
<ReviewContent item={item} getReviews={getReviews}/>
<ProductFooter item={item} getReviews={getReviews}/>
export const ProductFooter = ({getReviews}) => {
console.log(getReviews());
return (
<div>
</div>
)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question