Challenge: https://learn.freecodecamp.org/front-end-libraries/react/create-a-component-with-composition
I got stuck in a challenge at the path of learning React. That’s I wasn’t expecting.
Please give me the solution to this challenge. I tried to solve this challenge many times. But failed to succeed. Please help me to solve this challenge.
The code I tried-
const ChildComponent = () => {
return (
<div>
<p>I am the child</p>
</div>
);
};
class ParentComponent extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<h1>I am the parent</h1>
{ /* change code below this line */ }
{ChildComponent()}
{ /* change code above this line */ }
</div>
);
}
};