JavaScript React Basics (retired) Thinking in Components PropTypes and DefaultProps

Ashton Norton
Ashton Norton
7,704 Points

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.