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

Hiep Nguyen
Hiep Nguyen
420 Points

Hey, it's my code. I ran well without changing "props" to "state"

Hey, it's my code. I ran well without changing "props" to "state" but having trouble when changing "Need prop initialPlayers to be specified in Application"

var Application = React.createClass({ propTypes: { title: React.PropTypes.string, initialPlayers: React.PropTypes.arrayOf(React.PropTypes.shape({ name: React.PropTypes.string.isRequired, score: React.PropTypes.number.isRequired, id: React.PropTypes.number.isRequired, })), },

getDefaultProps: function() { return{ title: "Scoreboard", } },

getInitialState: function() { return{ players: this.props.initialPlayers, }; },

render: function() { return ( <div className="scoreboard"> <Header title={this.props.title} />

  <div className="players">
    {this.props.players.map(function(player){
      return <Player name={player.name} score ={player.score} key={player.id} />
    })}
  </div>
</div>

); } });

Steven Parker
Steven Parker
229,732 Points

Is this part of a course challenge? A link to the challenge page would be very helpful.

Formatting your could would also be nice, see the Markdown Cheatsheet pop-up below the "Add an Answer" section for instructions. :arrow_heading_down: