Samsung-8LNGewBvx mobile under 500

0
Posted at March 3, 2021 44 Views . 0 Saved .
2 Comments
Majd Warrak
import React, { useEffect } from "react"; import "./style.css"; import { useSelector, useDispatch } from "react-redux"; import { getAllCategories } from "../../actions"; /** * @author * @function MenuHeader **/ const MenuHeader = (props) => { const category = useSelector((state) => state.category); const dispatch = useDispatch(); useEffect(() => { dispatch(getAllCategories()); }, []); const renderCategories = (categories) => { let myCategories = []; for (let category of categories) { myCategories.push( <li key={category.name}> {category.parentId ? ( <a href={`/${category.slug}?cid=${category._id}&type=${category.type}`} > {category.name} </a> ) : ( <span>{category.name}</span> )} {category.children.length > 0 ? ( <ul>{renderCategories(category.children)}</ul> ) : null} </li> ); } return myCategories; }; return ( <div className="menuHeader"> <ul> {category.categories.length > 0 ? renderCategories(category.categories) : null} </ul> </div> ); }; export default MenuHeader;
Majd Warrak
please help me how I can get rid of the id that shows by every mobile category