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 trialHanJoon Kim
Full Stack JavaScript Techdegree Student 15,388 PointsReact Basics: Decomposing our Application Uncaught ReferenceError: Player is not defined
function Header(props){
return (
<div className="header">
<h1>{props.title}</h1>
</div>
);
}
Header.propTypes = {
title: React.PropTypes.string.isRequired,
};
function Application(props) {
return (
<div className="player">
<div className="player-name">
{props.name}
</div>
<div className="player-score">
<div className="counter">
<button className="counter-action decrement"> - </button>
<div className="counter-score"> {props.score} </div>
<button className="counter-action increment"> + </button>
</div>
</div>
</div>
);
}
Player.propTypes = {
name: React.PropTypes.string.isRequired,
score: React.PropTypes.number.isRequired,
};
function Application(props) {
return (
<div className="scoreboard">
<Header title={props.title} />
<div className="players">
<Player name="Jim Hoskins" score={31} />
<Player name="Andrew Chalkley" score={33} />
</div>
</div>
);
}
Application.propTypes = {
title: React.PropTypes.string,
};
Application.defaultProps = {
title: "Scoreboard",
}
ReactDOM.render(<Application />, document.getElementById('container'));
```Javascript
However, unlike the video, this code is not working...
and I'm getting this error code.
app.jsx:31 Uncaught ReferenceError: Player is not defined
at eval (eval at transform.run (babel-browser.min.js:4), <anonymous>:57:1)
at Function.transform.run (babel-browser.min.js:4)
at exec (babel-browser.min.js:4)
at babel-browser.min.js:4
at XMLHttpRequest.xhr.onreadystatechange (babel-browser.min.js:4)
(anonymous) @ app.jsx:31
transform.run @ babel-browser.min.js:4
exec @ babel-browser.min.js:4
(anonymous) @ babel-browser.min.js:4
xhr.onreadystatechange @ babel-browser.min.js:4
XMLHttpRequest.send (async)
transform.load @ babel-browser.min.js:4
run @ babel-browser.min.js:4
runScripts @ babel-browser.min.js:4
Can anyone please help?
... Am I the only one who can hardly make progress in React Track?
1 Answer
Seth Kroger
56,413 PointsIn your code you declared two different functions with the name Application. I'm pretty sure one of those is supposed to be named Player instead.