Skip to content
Justice Tech School

JSX Expressions

Any JavaScript expression goes inside curly braces: variables, math, function calls and ternaries. Statements such as if and for do not.

Example
const price = 20;
const view = <p>Total: {price * 2} {price > 10 ? 'High' : 'Low'}</p>;

Exercise

Insert a value.

<p>{}</p>

Quiz Test

Can you put an if statement inside braces?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.