Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript React Basics Thinking in Components Create a Component

Trouble 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

https://github.com/StephenDGarcia/React_Scoreboard

4 Answers

Austin Whipple
Austin Whipple
29,686 Points

It 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>`
     );
}

That 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?

I'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')
);