React Course 12 is it a bug?

Tell us what’s happening:
I really can’t find what is not working in this code.

  **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

const Fruits = function() {
return (<div></div>);
}

const Vegetables = function() {
return (<div></div>);
}
ReactDOM.render(<TypesOfFood />, document.getElementById('challenge-node'))
  **Your browser information:**

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36

Challenge: Render a Class Component to the DOM

Link to the challenge:

I placed the Fruits and Vegetables components under ReactDom.render() and the problem was solved.

You are not supposed to create the Fruits and Vegetables components.

Both the Fruits and Vegetables components are defined for you behind the scenes

If you remove the definition of the components it works as expected.

1 Like

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