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 React Basics (retired) Thinking in Components PropTypes and DefaultProps

propTypes error

I'm getting the error below every time I try run this code. As far as I can tell my code looks exactly like the example in the video.

SyntaxError: http://port-80-xxj1ujnenf.treehouse-app.com/app.jsx: Unexpected token (39:31)
  37 | }
  38 | 
> 39 | Application.propTypes = { title: React.PropTypes.string, };
     |                                ^
  40 | 
  41 | Application.defaultProps = {
  42 |   title: "Scoreboard"

My code is below:

function Application(props) {
  return (
    <div className="scoreboard">
      <div className="header">
        <h1>{props.title}</h1>  
      </div>
      <div className="players">
        <div className="player">
          <div className="player-name">
            Ashton Norton
          </div>
          <div className="player-score">
            <div className="counter">
              <button className="counter-action decrement"> - </button>
              <div className="counter-score"> 32 </div>
              <button className="counter-action increment"> + </button>
            </div>
          </div>
        </div>
      </div>

      <div className="players">
        <div className="player">
          <div className="player-name">
           Saiyu Norton
          </div>
          <div className="player-score">
            <div className="counter">
              <button className="counter-action decrement"> - </button>
              <div className="counter-score"> 32 </div>
              <button className="counter-action increment"> + </button>
            </div>
          </div>
        </div>
      </div>
  );
}

Application.propTypes = { 
  title: React.PropTypes.string, 
};

Application.defaultProps = {
  title: "Scoreboard"
};

ReactDOM.render(<Application title="My Scoreboard" />, document.getElementById('container'));

1 Answer

You're missing a closing <div> tag in your JSX. Just add another </div> to the end of your return statement.