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 trial

JavaScript

GIFT AKARIS
GIFT AKARIS
4,383 Points

React props

Going through the React course, I passed followed the video and had errors , I managed to changed and got no error and had no error.

Notice the App component that props is passed, but using props.playersDetails gives an error hence i used playersDetails.map instead of props.playersDetails.map from as from the course .

Just wanted to confirm am not wrong even though my app is working

const playersDetails = [
  { name: "Merry", score: 45 },
  { name: "Ode", score: 45 },
  { name: "Opp", score: 23 },
  { name: "functions-yeah", score: 57 }
];

const App = props => {
  console.log(playersDetails);
  return (
    <div id="scorboard">
      <Header title="scoreboard" totalPlayers={playersDetails.length} />
      {playersDetails.map((player, i) => (
        <Players key={i} name={player.name} score={player.score} />
      ))}
    </div>
  );
};

export default App;