Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMicah Cleveland
633 PointsQuestion answered later on in the video.
App Updated Code:
const App = (props) => { return ( <div className="scoreboard"> <Header title="Scoreboard" totalPlayers={3} />
{ props.initialPlayers.map( playerObj =>
<Player
name={playerObj.name}
score={playerObj.score}
/>
)}
</div>
);
}
Note: copied the list of players from teachers notes assigning them to a constant variable and using square brackets.
Full Error: react_devtools_backend.js:4026 Warning: Each child in a list should have a unique "key" prop.
Check the render method of App
. See https://fb.me/react-warning-keys for more information.
in Player (created by App)
in App
2 Answers
Micah Cleveland
633 PointsThis was just a warning however I was curious. I was able to get rid of the warning by adding a key attribute w/ unique value to the <Player /> element.
Micah Cleveland
633 PointsMark Sebeck Thank you.
Mark Sebeck
Treehouse Moderator 38,304 PointsMark Sebeck
Treehouse Moderator 38,304 PointsGreat job figuring it out and thanks for updating the question. Will be great for other students with the same question. I marked your answer Best for you