[SOLVED] What i am doing wrong? Render a Class Component to the DOM

Tell us what’s happening:

What is wrong here?

Your code so far


class TypesOfFood extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <div>
        <h1>Types of Food:</h1>
        {/* change code below this line */}
        <Fruits />
        <Vegetables />
        {/* change code above this line */}
      </div>
    );
  }
};

// change code below this line
class Fruits extends React.Component {
  render() {
    return (
      <div>
        <h2> Soy una fruta </h2>
      </div>
    )
  }
}


class Vegetables extends React.Component {
  render() {
    return (
      <div>
        <h2> Soy una vegetable </h2>
      </div>
    )
  }
}

ReactDOM.render(<TypesOfFood /> , document.getElementById('challenge-node'));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Avast/70.0.917.103.

Link to the challenge:

Fruit and Vegetable is already defined for you. You simple have to delete the Fruit and Vegetable component declaration from your code.

1 Like

@oliuradu The challenge is looking for you to render a <TypesOfFood /> component. From the instructions:

Both the Fruits and Vegetables components are defined for you behind the scenes. Render both components as children of the TypesOfFood component, then render TypesOfFood to the DOM. There is a div with id='challenge-node' available for you to use.

Try that and let us know what questions you have.

1 Like

Thank you! I didn’t read that

Thanks @camper ! Now i can go to the next lection