3.
What do you need to change about this code to get it to run?
import react from 'react';
class Greeting extends React.Component {
render() {
return <h1>Hello, {this.props.name}!</h1>;
}
}
// Usage example
const App = () => {
const userName = "John";
return <Greeting name={userName} />;
};
Capitalize render.
Add quotes around the return value.
Capitalize react.
The code is already correct.
Correct: C
To use the React library and its components, you need to import it at the beginning of your code. In this case, you need to add the following line at the top of the code: import React from 'react'; Without importing React, the code will throw an error because it won't recognize the JSX syntax used in the render method.