# Help with Render a Class Component to the DOM?

**URL:** <https://forum.freecodecamp.org/t/help-with-render-a-class-component-to-the-dom/260202>\
**Category:** General\
**Created:** [February 20, 2019, 1:06pm UTC](https://forum.freecodecamp.org/t/help-with-render-a-class-component-to-the-dom/260202 "2019-02-20T13:06:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![selsela](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@selsela](https://forum.freecodecamp.org/u/selsela)\
**Post date:** [February 20, 2019, 1:06pm UTC](https://forum.freecodecamp.org/t/help-with-render-a-class-component-to-the-dom/260202/1 "2019-02-20T13:06:34Z")

</div>

**Tell us what’s happening:**  
I tried everything I possibly could but my code still doesn’t work. Could it be something to do with FreeCodeCamp itself or do I have to add/remove something else in my code?

**Your code so far**

```auto

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 />,'challenge-node')

```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36`.

---

<div class="post-metadata">

**Author:** ![chuckadams](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/chuckadams/32/109651_2.png) [@chuckadams](https://forum.freecodecamp.org/u/chuckadams)\
**Post date:** [February 20, 2019, 1:08pm UTC](https://forum.freecodecamp.org/t/help-with-render-a-class-component-to-the-dom/260202/2 "2019-02-20T13:08:39Z")

</div>

```auto
ReactDOM.render(<TypesOfFood />,'challenge-node')

```

The second argument of this is incorrect – you need to render to a DOM node, which you can get with `document.getElementById` The challenge text to the left should contain an example of how to use that particular method. Hope this helps. 🙂

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:04pm UTC](https://forum.freecodecamp.org/t/help-with-render-a-class-component-to-the-dom/260202/3 "2021-01-17T20:04:54Z")

</div>


