i'm trying to map over an object but I struggle to manage to get the right results
my example array of objects
[
{
"round": 1,
"points": 0,
"colors": [
"#c99e15",
"#b9bbbd",
"#7C0B2B",
"#97CC04",
"#7fffd4"
]
},
{
"round": 2,
"points": 0,
"colors": [
"#c99e15",
"#b9bbbd",
"#7C0B2B",
"#476C9B",
"#ADD9F4"
]
}
]
I'm trying to get a table where I get
ROUND X // POINTS
- color 1
- color 2
- color 3
- etc
ROUND X+1 // POINTS
- color 1
- color 2
- color 3
- etc
etc
my current code looks likes this, but this unfortunately keeps duplicating the results in "colors" values
<ul>
{obj.map((round) => (
<li key={round.round}>{round.round}
<ul>
{obj.map((outerElement) =>
outerElement.colors.map((colors) => (
<li key={colors} style={{ backgroundColor: colors }}>
{colors}
</li>
))
)}
</ul>
</li>
))}
</ul>