import React, { useEffect, useState } from 'react'; import useCategoryManagement from '../hooks/useCategoryManagement'; import NextImage from 'next/image'; import Link from "next/link"; import router from 'next/router'; import { createSlug } from '@/core/utils/slug'; const CategoryDynamic = () => { const { categoryManagement } = useCategoryManagement(); const calculateLevel3Products = (category) => { return category.childFrontendIdI.reduce((total, child) => total + (child.numFound || 0), 0); }; const calculateLevel2Products = (category) => { return category.categories.reduce((total, subCategory) => { const level3Products = calculateLevel3Products(subCategory); return total + (subCategory.numFound || 0) + level3Products; }, 0); }; return (
{countLevel2} Produk tersedia
Lihat Semua{(subCategory.numFound || 0) + countLevel3} Produk
Lihat Semua