import React, { useEffect } from 'react' import { Box, Typography } from '@mui/material'; import { useParams } from 'react-router-dom'; import { useSelector, useDispatch } from 'react-redux'; import Grid from '@mui/material/Grid2'; import logoSrc from "../../assets/svg/logo.svg"; import ImageView from '../../components/ImageView/ImageView'; import ProductDetails from '../../components/ProductDetails'; import ProductSuggestion from '../../components/ProductSuggestion'; import ProductHistoryList from '../../components/ProductHistoryList'; import SocialMedia from '../../components/SocialMedia' import Feature from '../../components/Feature' import { fetchProduct } from '../../redux/slices/productSlice'; const Product = () => { let { pid } = useParams(); const product = useSelector((state) => state.products.product.data) const dispatch = useDispatch(); useEffect(() => { dispatch(fetchProduct(pid)) if(localStorage.getItem('amber-product-history')){ let productHistory = JSON.parse(localStorage.getItem('amber-product-history')) if(productHistory.includes(pid)) return productHistory = [pid, ...productHistory] productHistory = productHistory.slice(0, 6) productHistory = JSON.stringify(productHistory) localStorage.setItem('amber-product-history', productHistory) } else { let productHistory = [pid] productHistory = JSON.stringify(productHistory) localStorage.setItem('amber-product-history', productHistory) } }, []) return ( Logo {/* */} YOU MAY ALSO LIKE RECENTLY VIEWED ) } export default Product