In react I would like to display id and name of category. How to achieve this assuming the object below is somehow hard for me to understand.
[
{
"id": 1,
"category": {
"id": 1,
"name": "CALZATURA",
}
},
{
"id": 2,
"category": {
"id": 2,
"name": "PELLETTERIA",
}
}
]
dataItems.map((item, index) => {
return (
<div>
<h1>{item.title}</h1>
{category.map((c, i) => (
<div>
<p>{c.name}</p>
</div>
))}
</div>
);
});
{item.title}
{ category.map((c, i) =>{c.name}