I want to pass data from props into another component but I'm having trouble passing data from a nested array. My JSON has the following structure:
[
{
id: 1,
category: "Fish",
nodes: [
{
id: 1,
title: "Bacalhau com broa",
ingredients: [
"bacalhau",
"broa"
]
},
{
id: 2,
title: "Bacalhau à Zé do Pipo",
ingredients: [
"bacalhau",
"broa",
"5 cebolas"
]
},
],
}
];
and I've tried the following, where dishesData contains the nodes from the JSON:
{dishesData.map((dishes) => {
dishes.forEach((dish) => {
console.log(dish.title)
return <Dish title={dish.title} ingredients={dish.ingredients} />;
});
})}
The console.log(dish.title) is printing the correctly but not rendering my component to the page.