8.
What is the problem with the given code and how do you fix it?
const Component = () => {
<h1>Hello world!</h1>;
};
The component is not being exported properly.
The JSX element is missing a return statement.
Change the curly braces to parentheses
Surround the h1 in a div.
Correct: B
In order for the render method to work correctly, we need to return the JSX element from the component. So, to fix the problem, we need to modify the code as follows:
const Component = () => {
return <h1>Hello world!</h1>;
};
By adding the 'return' statement before the JSX element, it will be rendered correctly.