@shopgate/engage
Version:
Shopgate's ENGAGE library.
26 lines (24 loc) • 726 B
JavaScript
import { connect } from 'react-redux';
import { getProductShipping } from '@shopgate/pwa-common-commerce/product/selectors/product';
/**
* @param {Object} state The current application state.
* @param {Object} props The component props.
* @return {Object} The extended component props.
*/
const mapStateToProps = (state, props) => ({
shipping: getProductShipping(state, props)
});
/**
* @param {Object} next The next component props.
* @param {Object} prev The previous component props.
* @return {boolean}
*/
const areStatePropsEqual = (next, prev) => {
if (!prev.shipping && next.shipping) {
return false;
}
return true;
};
export default connect(mapStateToProps, null, null, {
areStatePropsEqual
});