Skip to content

Commit

Permalink
feat: lazy loading ForYouProducts
Browse files Browse the repository at this point in the history
  • Loading branch information
Moamal-2000 committed Oct 7, 2024
1 parent 34004a5 commit b5934ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { productsData } from "src/Data/productsData";
import ProductCard from "../../ProductsCards/ProductCard/ProductCard";
import s from "./ForYouProducts.module.scss";

const ForYouProducts = () => {
const ForYouProducts = ({ loading = "eager" }) => {
const forYouProducts = productsData.filter((_, i) => i < 4);

return (
<div className={s.forYouProducts}>
{forYouProducts.map((product) => (
<ProductCard key={product.id} product={product} />
<ProductCard key={product.id} product={product} loading={loading} />
))}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const ForYouSection = () => {
<Link to="/products">{t("buttons.seeAll")}</Link>
</header>

<ForYouProducts />
<ForYouProducts loading="lazy" />
</section>
);
};
Expand Down

0 comments on commit b5934ee

Please sign in to comment.