Chapter 3. Introduction to JSX

This chapter covers

  • Understanding JSX and its benefits
  • Setting up JSX transpilers with Babel
  • Being aware of React and JSX gotchas

Welcome to JSX! It’s one of the greatest things about React, in my opinion—and one of the most controversial subjects related to React in the minds of a few developers I spoke with (who, not surprisingly, haven’t yet built anything large in React).

Thus far, we’ve covered how to create elements and components so that you can use custom elements and better organize your UIs. You used JavaScript to create React elements, instead of working with HTML. But there’s a problem. Look at this code, and see if you can tell what’s happening:

render() { return React.createElement( 'div', ...

Get React Quickly: Painless web apps with React, JSX, Redux, and GraphQL now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.