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) First Steps in React JSX Review

Ana María Benites Rodríguez
Ana María Benites Rodríguez
1,011 Points

JSX syntax is the same as HTML in JavaScript files.

why is this statement false? thanks!

2 Answers

It’s an HTML-like syntax for writing JavaScript, but its still javascript

Robert Schaap
Robert Schaap
19,836 Points

It looks like HTML which is useful during development, but it actually just compiles down to JavaScript. Think of it like this, when you're typing <div>Ana</div>, what you're actually typing under the hood is React.createElement("div", null, "Ana"); The nice JSX syntax is syntactic sugar as it's called.

edit- if you want to get an idea, head over to www.babeljs.io, there you can type some JSX or plain JS and see what it compiles to.