Complete the code to create a simple React component that shows a greeting.
function Greeting() {
return <h1>[1]</h1>;
}The component returns a heading with the greeting text inside quotes to show it as a string.
Complete the code to use the Greeting component inside another component.
function App() {
return <div>[1]</div>;
}To use a React component inside JSX, write it as a tag with a capitalized name and a closing slash.
Fix the error in the component by completing the return statement correctly.
function Welcome() {
return [1];
}The return statement must return valid JSX with tags properly enclosed in angle brackets.
Fill both blanks to create a component that shows a message inside a section with a class.
function Message() {
return <section className=[1]>[2]</section>;
}The className attribute needs a string with quotes. The content inside the section is also a string in quotes.
Fill all three blanks to create a component that returns a list with three items.
function List() {
return (
<ul>
<li>[1]</li>
<li>[2]</li>
<li>[3]</li>
</ul>
);
}Each list item needs a string inside quotes to display the fruit names correctly.