21.
What is the output of the following React code?
import React from 'react';
export function App() {
const name = 'John';
const age = 25;
const city = 'New York';
return (
<div>
<p>Name: {name}</p>
<p>Age: {age}</p>
<p>City: {city}</p>
</div>
);
};
Name: 25
Age: New York
City: {console.log(name, age, city)}
Name: {name}
Age: {age}
City: {city}
Name: John
Age: 25
City: New York
None of the above.
Correct: C
The code will output
Name: John
Age: 25
City: New York
The variables name, age, and city are assigned their respective values, and they are displayed inside the JSX expressions correctly in the output HTML elements.