26.
What should the console display when the following simple React code is run?
import React from 'react';
function App() {
const greeting = 'Hello, React!';
console.log(greeting);
return (
<div>
<h1>{greeting} You are awesome! </h1>
</div>
);
}
export default App;
"Hello, React!"
"undefined"
There will be an error
"Hello, React! You are awesome!"
Correct: A
The console should read "Hello, React!" because the variable greeting is defined and logged to the console before being rendered in the <h1> element.