Skip to content

Commit e0f27bb

Browse files
changing methods to access normalized data
1 parent 1c0bdce commit e0f27bb

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/Pages/collection/collection.component.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import './collection.styles.scss'
66

77
function CollectionPage({ match, collection }) {
88
const { title, items } = collection
9+
console.log(match.params)
910
return (
1011
<div className="collection-page">
1112
<h2 className="title">{title}</h2>

src/components/collections-overview/collections-overview.component.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import { connect } from "react-redux";
33
import { createStructuredSelector } from "reselect";
44
import './collections-overview.styles.scss'
5-
import { selectCollections } from "../../redux/shop/shop.selector";
5+
import { selectCollectionsForPreview } from "../../redux/shop/shop.selector";
66
import CollectionPreview from "../collection-preview/Collection-preview.component";
77

88
function CollectionsOverview({ collections }) {
@@ -19,6 +19,6 @@ function CollectionsOverview({ collections }) {
1919

2020

2121
const mapStatetoProps = createStructuredSelector({
22-
collections: selectCollections
22+
collections: selectCollectionsForPreview
2323
})
2424
export default connect(mapStatetoProps)(CollectionsOverview)

src/redux/shop/shop.selector.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ export const selectCollections = createSelector(
77
shop => shop.collections
88
)
99

10+
export const selectCollectionsForPreview = createSelector(
11+
[selectCollections],
12+
collections => Object.keys(collections).map(key => collections[key])
13+
)
14+
1015
export const selectCollection = collectionUrlParam =>
1116
createSelector(
1217
[selectCollections],

0 commit comments

Comments
 (0)