4.
In the following React code snippet, what line is missing to properly render the component?
import React from 'react';
class MyComponent extends React.Component {
render() {
return (
<div>
<h1>Hello, World!</h1>
// Missing line
</div>
);
}
}
<img src="image.jpg" alt="My Image">
<button>Click Me<button/>
<MyCustomComponent >
<p>This is my component.</p>
Correct: D
To properly render the component, the missing line should be <p>This is my component.</p>. The line adds a paragraph element with the text "This is my component." inside the component's JSX.