Tell us what’s happening:
I don’t know how to solve this can anyone help?
There are two functional components defined in the code editor, called TypesOfFruit
and Fruits
. Take the TypesOfFruit
component and compose it, or nest it, within the Fruits
component. Then take the Fruits
component and nest it within the TypesOfFood
component. The result should be a child component, nested within a parent component, which is nested within a parent component of its own!
Your code so far
const TypesOfFruit = () => {
return (
<div>
<h2>Fruits:</h2>
<ul>
<li>Apples</li>
<li>Blueberries</li>
<li>Strawberries</li>
<li>Bananas</li>
</ul>
</div>
);
};
const Fruits = () => {
return (
<div>
{ /* change code below this line */ }
{ /* change code above this line */ }
</div>
);
};
class TypesOfFood extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<h1>Types of Food:</h1>
{ /* change code below this line */ }
{ /* change code above this line */ }
</div>
);
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
.
Challenge: Use React to Render Nested Components
Link to the challenge: