React Challenge: "Create a Component with Composition" freezes every time the challenge page loads

I entered:

<ParentComponent>
<ChildComponent />
</ParentComponent>

as my answer, clicked Submit, and the page just completely froze. I closed the tab and tried going back to the challenge but the tab keeps on freezing as soon as the challenge’s page loads. Please help.

@JPili I am also having the same problem. I cleared my cookies and was able to return to the page. As for the correct solution I am still working on that.

/* I was able to complete the challenge */

The description on the challenge was a bit misleading in my opinion. My code is below.

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>
    );
  }
};

It apparently only needed a custom HTML tag that referenced the ‘ChildComponent’ component. I guess the ‘

’ tag that stated “I am the parent” referenced that only the ‘ChildComponent’ component was needed.

1 Like

@j8ahmed Someone helped me figure it out here: Is this how you nest React components?

It turns out the example the challenge gives you is not the way you do it.

@JPili was just editing my response as I completed the challenge. I will look into the post. Thanks!

haha yeah I just saw you figured it out. I’m glad you got it!

@j8ahmed: Thank you for the tips. I still got this challenge froze but passed the next one. Yay!

@vandao288 you are most welcome! I can confidently say that as the challenges progressed React got a lot more comfortable to work with. Best of luck with the rest of the challenges.

1 Like