Https://www.freecodecamp.org/learn/front-end-development-libraries/react/create-a-component-with-composition

Each time I try to complete the exercise, my browser freezes.
here is the exercise link:

Hi @shagariboy !

I just tried it and didn’t experience any issues.

Have you tried other browsers?

I tried it in google chrome and it worked for me.

i am using Google Chrome. Version 100.0.4896.75 (Official Build) (x86_64)

What Device are you using:

what’s your code? if you create accidentally an infinite loop that can crash your browser (like a component rendering inside itself)

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 */ }
return (
<ParentComponent>
<ChildComponent/>
</ParentComponent>
)

        { /* Change code above this line */ }
      </div>
    );
  }
};

you are rendering ParentComponent inside itself, that causes the infine loop and break the page

Thank you. I got it now.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.