React - Create a Component with Composition

Tell us what’s happening:

The first test triggers without entering a div element, resulting in confusion. I believe it is counting the div that is in the provided code.

I have solved this lesson already and am notifying for support reasons.

(Also, these Front-End Library sections could be made like the Responsive Web Design & JavaScript sections, where they are lessons instead of project-esque tests. I’d be happy to do this, as it would look great on my resume.)

Your code so far

const ChildComponent = () => {
  return (
    <div>
      <p>I am the child</p>
    </div>
  );
};

class ParentComponent extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <div> //  i believe this `div` is being counted in the test
        <h1>I am the parent</h1>
        { /* Change code below this line */ }
    <div>
      <h1>I am the parent</h1>
      <ChildComponent />
    </div>
        { /* 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/126.0.0.0 Safari/537.36

Challenge Information:

React - Create a Component with Composition

the work to update the curriculum is in progress

1 Like

Again, do not use AI to generate responses to users on the forum.

1 Like

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