Course contentsShow
← React
Lesson 77 of 2,3963. JSX FundamentalsFree lesson

Why JSX Improves Developer Experience

How JSX's HTML-like syntax makes component trees more readable and maintainable than function calls.

Why JSX Improves Developer Experience

What you'll learn: How JSX's HTML-like syntax makes React code dramatically easier to read and maintain compared to raw function calls.

The Readability Problem

You've seen that JSX compiles to React.createElement calls. While those function calls work perfectly, they create a serious problem for humans: they're hard to read.

Compare these two ways of writing the same UI:

With createElement (what you've learned so far):

React.createElement('div', { className: 'card' },
  React.createElement('h2', null, 'Welcome'),
  React.createElement('p', null, 'This is a paragraph'),
  React.createElement('button', { onClick: handleClick }, 'Click me')
)

With JSX (what you're learning now):

<div className="card">
  <h2>Welcome</h2>
  <p>This is a paragraph</p>
  <button onClick={handleClick}>Click me</button>
</div>

Why JSX Wins

The JSX version instantly shows you the structure of your UI. You can see the nesting, the hierarchy, and the content at a glance. It looks like the HTML you already know.

The createElement version forces you to mentally parse nested function calls, count parentheses, and track which arguments belong where. With deeply nested components, it becomes nearly impossible to read.

Analogy: It's like describing a house. You could say "There's a structure containing a room containing a table containing a vase," or you could draw a simple floor plan. JSX is the floor plan.

Maintainability Matters

When you return to code six months later, JSX lets you understand component structure in seconds. With function calls, you'd need minutes to decode the same information.

Key Takeaway: JSX transforms React from technically functional but painful to actually pleasant to work with—its HTML-like syntax maps directly to how we visualize UI structure in our minds.