Reputation: 926
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
Upvotes: 3
Views: 3866
Reputation: 21
The message wrapped in curly braces below:
let message = "Hi there"; const element = <p>{message}</p>
The right answer is: (c.) JS expression
Upvotes: 2
Reputation: 85545
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.
Upvotes: 6