UNPKG

@shopgate/engage

Version:
27 lines (25 loc) 758 B
import { connect } from 'react-redux'; import { getProductPriceData } from '@shopgate/pwa-common-commerce/product'; /** * Maps the contents of the state to the component props. * @param {Object} state The current application state. * @param {Object} props The component props. * @return {Object} The extended component props. */ const mapStateToProps = (state, props) => ({ price: getProductPriceData(state, props) }); /** * @param {Object} next The next component props. * @param {Object} prev The current component props. * @return {boolean} */ const areStatePropsEqual = (next, prev) => { if (!prev.price && next.price) { return false; } return true; }; export default connect(mapStateToProps, null, null, { areStatePropsEqual });