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 trialJack Jackson
6,082 PointsCannot read property 'name' of undefined
I've triple checked everything but I'm getting an error of Cannot read property 'name' of undefined
in Scoreboard.js:
const playerComponents = players.map((player, index) => {
return (
<Player
index={index}
name={player.name}
score={player.score}
key={player.name}
updatePlayerScore={updatePlayerScore}
removePlayer={removePlayer}
/>
)
});
Any idea what's going wrong, or how I can debug it?
1 Answer
Jack Jackson
6,082 PointsWhoops! Figured it out. I was missing
return player;
from the player.js reducer on the case of UPDATE_PLAYER_SCORE
That's what I get for listening to Guil at 1.75x speed!
Olga Isakova
5,349 PointsOlga Isakova
5,349 PointsThanks a lot for the follow up, Jack Jackson, you just saved me from an excruciating debugging session:)
Danielle Quevedo
17,935 PointsDanielle Quevedo
17,935 PointsYeah, ditto -- thanks for posting, Jack Jackson -- I did the exact same thing. You saved me some trouble.
Mark Ryan
Python Web Development Techdegree Graduate 28,648 PointsMark Ryan
Python Web Development Techdegree Graduate 28,648 PointsYou are the best. Totally did the same thing.