Render-a-class-component-to-the-dom

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
ReactDOM.render(<TypesOfFood />, document.getElementById ="challenge-node");
1 Like

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

markdown_Forums

OK, looking at your code, It looks to be like it is the last line that is the problem. That is not how you use document.getElementById. A typical usage would be:

document.getElementById("element-id")
2 Likes

Hi thanks for help


Can you please paste all of your code?