This is my data
export const courses = [
{
id: 0,
title: "first year",
subjects: [
{ id: 0, class: "french" },
{ id: 1, class: "history" },
{ id: 2, class: "geometry" }
],
},
{
id: 1,
title: "second year",
subjects: [
{ id: 0, class: "geography" },
{ id: 1, class: "chemistry" }
],
}
]
And this my code
export const studies = courses.map((course) => (
<div key={course.id}>
<h2>{course.title}</h2>
<li>
{course.subjects.class}
</li>
</div>
);
My aim is to list all classes per title. I tried adding a second key also in my list for the classes and the subjects per title, but no success. How can I show all classes within the subjects per title?