React - > What do you call the message wrapped in curly braces below?

Viewed 3340

could you please help with finding the right answer for the quiz question:

What do you call the message wrapped in curly braces below?

let message = "Hi there"; 
const element = <p>{message}</p>

a. JS function

b. JS element

c. JS expression

d. JSX wrapper

Is the right answer "JSX wrapper" or "JS expression" reference link from the official docs https://reactjs.org/docs/introducing-jsx.html

2 Answers

That's just a JS Expression wrapped in JSX. So, the right answer is c.

You can take reference: JSX is an Expression Too

JSX Wrapper is nothing but JSX Element like we can call wrapper to html element that is root of. So, the JSX wrapper is JS Expression wrapping element. In the example <p /> is what you may call JSX wrapper.

The message wrapped in curly braces below:

let message = "Hi there"; 
const element = <p>{message}</p>

The right answer is: (c.) JS expression

Related