JSX Expressions in React
From the React Components & JSX cheat sheet · JSX Fundamentals · verified Jul 2026
JSX Expressions
Embed JavaScript expressions in JSX
javascript
function UserCard() {
const name = 'Alice'
const age = 25
const isAdult = age >= 18
return (
<div>
{/* Variables */}
<h2>{name}</h2>
{/* Math expressions */}
<p>Age: {age + 1} next year</p>
{/* Ternary operator */}
<p>{isAdult ? 'Can vote' : 'Too young'}</p>
{/* Function calls */}
<p>Uppercase: {name.toUpperCase()}</p>
</div>
)
}🟢 Essential - Use {} to embed any JS expression
💡 Expressions produce values, statements don't
⚠️ Can't use if/for/while directly, use ternary or map
jsxexpressionsessential