Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
JSX Embedding Expressions | Getting Started: JSX
Introduction to React
course content

Course Content

Introduction to React

Introduction to React

1. Getting Started: ES6
2. Getting Started: JSX
3. React in Practice
4. React Components
5. Controlling Data & Content
6. Hooks
7. React Router

bookJSX Embedding Expressions

One of the main advantages of JSX is its capability to incorporate expressions directly into the code, enabling the inclusion of dynamic values within components or elements.

To include an expression in JSX, we enclose it within curly braces {}. This notation indicates to JSX that the contents should be treated as JavaScript.

The displayed value for the variable heading will be: Hello, Josh Perez! Similarly, you can do something more complicated and display the evaluated sum of two variables:

The output for the above expression will be: The sum of 7 and 10 is 17 It is also possible to embed ternary operators which can show conditional output:

The output for the above expression will be: You have passed the test.

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 3
some-alt