Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mirsujat committed Oct 8, 2019
1 parent d4c0191 commit 8ef57df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";
import { withRouter } from "react-router-dom";

import CustomButton from "../custom-button/custom-button.component";
import CartItem from "../cart-item/cart-item.component";
Expand Down Expand Up @@ -28,4 +27,4 @@ const CartDropdown = ({ cartItems, history, toggleCartHidden }) => (
</div>
);

export default withRouter(CartDropdown);
export default CartDropdown;
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import { withRouter } from "react-router-dom";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";

Expand All @@ -7,9 +8,10 @@ import { toggleCartHidden } from "../../redux/cart/cart.actions.js";

import CartDropdownComponent from "../../components/cart-dropdown/cart-dropdown.component";

const CartDropdownContainer = ({ cartItems, toggleCartHidden }) => (
const CartDropdownContainer = ({ cartItems, history, toggleCartHidden }) => (
<CartDropdownComponent
cartItems={cartItems}
history={history}
toggleCartHidden={toggleCartHidden}
></CartDropdownComponent>
);
Expand All @@ -22,7 +24,9 @@ const mapDispatchToProps = dispatch => ({
toggleCartHidden: () => dispatch(toggleCartHidden())
});

export default connect(
mapStateToProps,
mapDispatchToProps
)(CartDropdownContainer);
export default withRouter(
connect(
mapStateToProps,
mapDispatchToProps
)(CartDropdownContainer)
);

0 comments on commit 8ef57df

Please sign in to comment.