This commit is contained in:
2023-06-20 20:46:51 +01:00
parent 2d366cd103
commit 3ce97a4b76
9 changed files with 208 additions and 155 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ export default function MainSection({
() => ({ All: "All Categories", ...categories }),
[categories]
);
const [tab, setTab] = useState(marketCategories.All);
const [tab, setTab] = useState(Object.keys(marketCategories)[0]);
// Convert to array in order to map
const mappedArray = Object.entries(marketCategories).map(([key, value]) => {
@@ -24,7 +24,7 @@ export default function MainSection({
setTab(value);
};
useEffect(() => {
if (tab === marketCategories.All) {
if (tab === "All") {
setProducts(marketPlaceProduct);
} else {
const filteredProducts = marketPlaceProduct.filter((product) =>