# Codes not working

**URL:** https://forum.kirupa.com/t/codes-not-working/640070
**Category:** web dev
**Created:** [July 22, 2019, 3:52am UTC](https://forum.kirupa.com/t/codes-not-working/640070 "2019-07-22T03:52:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Ramzy\_Phailin](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ramzy_phailin/32/9773_2.png) [@Ramzy\_Phailin](https://forum.kirupa.com/u/Ramzy_Phailin)
#### Post date: [July 22, 2019, 3:52am UTC](https://forum.kirupa.com/t/codes-not-working/640070/1 "2019-07-22T03:52:34Z")

</div>

Hi I’ve been practised from the Learn React: Hands-On Guide to Building Web Applications Using React and Redux (2nd Edition).  
I am currently viewing the chapter 3 on the component. When I try to follow through and see the output on browser nothing seems appear. Any idea why? I’m a starter, please bear with me.

Here is my code:

```
    class HelloWorld extends React.Component { render() { return
    <p>Hello, componentized world!</p> } } ReactDOM.render(
    <div>
        <HelloWorld/>
        <HelloWorld/>
        <HelloWorld/>
        <HelloWorld/>
        <HelloWorld/>
    </div>, document.querySelector("#container"));
</script>

```

---

<div class="post-metadata">

### Author: ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)
#### Post date: [July 22, 2019, 5:35am UTC](https://forum.kirupa.com/t/codes-not-working/640070/2 "2019-07-22T05:35:25Z")

</div>

Hi Ramzy - welcome to the forums! 🙂

Can you post your full code? I’m only seeing bits and pieces in the response. Also, if you bring up your browser developer tools, do you see any error showing up?

Thanks,  
Kirupa

---

<div class="post-metadata">

### Author: ![jopeters](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@jopeters](https://forum.kirupa.com/u/jopeters)
#### Post date: [November 12, 2019, 3:42pm UTC](https://forum.kirupa.com/t/codes-not-working/640070/4 "2019-11-12T15:42:57Z")

</div>

Hi Kirupa, had the same problem. Any help you could offer be much appreciated.

Attached is my code:

```auto
<!DOCTYPE html>
<html>
 
<head>
  <meta charset="utf-8">
  <title>React! React! React!</title>
  <script src="https://unpkg.com/react@16/umd/react.development.js"></script>
  <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
  <script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
  <style>
      #container {
        padding: 50px;
        background-color: #7f3621;    
      }
      #container h3 {
        font-size: 144px;
        font-family: sans-serif;
        color: #0080A8;
      }
  </style>
</head>
 
<body>
    <script type="text/babel">
    var destination = document.querySelector("#container");
    ReactDOM.render(
      <div id="container">
        <h3>Patrick</h3>
        <h3>Patrick</h3>
        <h3>Patrick</h3>
      </div>,
      destination
    );
    </script>
</body>
</html>

```

Error I got as follows:

```auto
react-dom.development.js:27710 Uncaught Error: Target container is not a DOM element.
    at Object.render (react-dom.development.js:27710)
    at <anonymous>:4:10
    at n (babel.min.js:12)
    at r (babel.min.js:12)
    at o (babel.min.js:12)
    at u (babel.min.js:12)
    at E (babel.min.js:1)

```

---

<div class="post-metadata">

### Author: ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)
#### Post date: [November 12, 2019, 8:49pm UTC](https://forum.kirupa.com/t/codes-not-working/640070/5 "2019-11-12T20:49:19Z")

</div>

@jopeters you’re missing a div element. Add this above the `<script>` tag:

```auto
<div id="container"></div>

```

This is what `document.querySelector("#container");` is looking for and assigns to `destination`, what will be the “target container”. When not found, `destination` becomes null and React can’t render to it.
