Skip to content

Commit

Permalink
fixed redux bug
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Wang12 committed Oct 13, 2023
1 parent 5958365 commit 2b58f0c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/ProductCard/ProductDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const ProductDetails: React.FC<ProductDetailsProps> = ({
console.log("id: ", id);
const {productDetails} = useProductDetails(id);
console.log("product details: ", productDetails);

return (
<div className='productDetailsContainer'>
<div className='productDetailsTop'>
Expand Down
4 changes: 2 additions & 2 deletions src/state/products/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Product, ProductDetails } from 'products';
import * as actionTypes from '../action-types';

interface ProductsState {
list: Product[],
productDetails: ProductDetails | null,
list: Product[];
productDetails: ProductDetails | null;
};

const initialState: ProductsState = {
Expand Down
2 changes: 1 addition & 1 deletion src/state/products/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import { ReduxState } from "state";

export const products = (state: ReduxState) => state.products.list;

export const productDetails = (id: number) => (state: ReduxState) => state.products.productDetails;
export const productDetails = (state: ReduxState) => state.products.productDetails;

0 comments on commit 2b58f0c

Please sign in to comment.