This is what I've been taught how to map through arrays with lists. I was wondering if there would be a better way to improve this by keeping it DRY.
I know I could make a single array with objects, however, it's for 3 different columns on a page.
If I were to make changes in the future and maintain the list, would this be sufficient enough?
const groceryList = [
{ Dairy: "Eggs"},
{ Dairy: "Milk"},
{ Dairy: "Cheese"},
];
const shoppingList = [
{ toBuy: "Soap"},
{ toBuy: "Garbage bags"},
];
const getHomeDepot = [
{ getTools: "Plywood"},
{ getTools: "Nails"},
]
{groceryList &&
groceryList.map((ingredients) => {
return (
<ul>
<li>
{ingredients.Dairy}
</li>
</ul>
);
{shoppingList &&
shoppingList.map((items) => {
return (
<ul>
<li>
{items.ToBuy}
</li>
</ul>
);
{getHomeDepot &&
getHomeDepot.map((tools) => {
return (
<ul>
<li>
{tools.getTools}
</li>
</ul>
);