hope you have a great day!
i want to ask something, and i'm still learning about how to display array (mapping) when it got another array inside, here's what i mean:
{
id: Math.floor(Math.random() * 100000),
date: moment()
.add(Math.floor(Math.random() * 100), "days")
.calendar(),
title: "someTitle",
people: [
{
id: Math.floor(Math.random() * 100000),
name: "someName",
photo: "somePhotos",
level: "someLevel",
},
{
id: Math.floor(Math.random() * 100000),
name: "someName",
photo: "somePhotos",
level: "someLevel",
},
{
id: Math.floor(Math.random() * 100000),
name: "someName",
photo: "somePhotos",
level: "someLevel",
},
],
},
and what i nead is i want to display them but i can't, here's my code looks like:
{someList?.map((item, i) => (
<div className="flex-none bg-white rounded-xl shadow-xl w-[20rem] ml-4 px-6 py-6">
<h1 className="text-[1.5rem] font-bold leading-none">
{item.title}
</h1>
<h1>{item.date}</h1>
<div className="h-1.5 bg-gray-200 rounded-full my-2"></div>
<h1 className="font-bold">someLevel</h1>
{item.people?.map((people, i) => {
<div className="border-[#DCDCDC] border-2 px-4 py-2 rounded-xl flex">
<div className="w-12 bg-red-400 h-12 rounded-full mr-2"></div>
<div className="flex-auto bg-blue-600">
<b>{people.name}</b>
</div>
</div>;
})}
</div>
))}
the problem is, item.title
and item.date
can be display, but .map
inside someList
cannot
am i doin it wrong?