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 trialStephen Garcia
Python Development Techdegree Student 11,647 PointsTrouble displaying
getting a syntax error on line 3 of unexpected token '<'. I swear it looks the same as the video and I even restarted the project. If anyone can see the problem it would be much appreciated
4 Answers
Stephen Garcia
Python Development Techdegree Student 11,647 PointsThat didn't seem to work. I'm copying the code from the Use a Component with JSX video at 00:37. Could it possibly be with my index.html and the React CDM's being older and needing updates?
Austin Whipple
29,725 PointsIt looks like you're going to need to wrap that chunk of HTML in backticks ( `) to tell the browser that it should expect interpolated HTML instead of more script instructions.
function Header () {
return (
`<header>
<h1>Scoreboard</h1>
<span>Players: 1</span>
</header>`
);
}
Louie Ambriz
7,639 PointsI'm having the same issue with this. I literally downloaded the files with the lesson and copied them and transferred them into the work space I and seeing the same error as Stephen.
function Header() {
return (
<header>
<h1>Scoreboard</h1>
<span className="stats">Players: 1</span>
</header>
);
}
ReactDOM.render(
<Header />,
document.getElementById('root')
);
Mary McCallum
5,483 PointsI found a possible solution here: https://stackoverflow.com/questions/44861564/react-jsx-error-unclosed-regular-expression.
Uninstalling JShint seems to help.