This question already has an answer here:
Can't get rid of "Warning: Each child in a list should have a unique "key" prop."
const Course = () => {
const list = course.parts.map(parts => <li key={course.parts.id}>{parts.name} {parts.exercises}</li>)
const exerscisesOnly = course.parts.map( x => x.exercises)
var all = 0;
for(var i = 0; i < exerscisesOnly.length; i++){
all = all + exerscisesOnly[i]
}
const Header = (props) => {
console.log(props)
return (
<div>
<h1>{props.course}</h1>
</div>
)
}
I have defined the key inside course.part.map but it doesn't want to work