Invariant Violation: _registerComponent(...): Target container is not a DOM element
Asked 07 September, 2021
Viewed 1.3K times
  • 55
Votes

I get this error after a making trivial React example page:


  

Uncaught Error: Invariant Violation: _registerComponent(...): Target container is not a DOM element.

Here's my code:

/** @jsx React.DOM */
'use strict';

var React = require('react');

var App = React.createClass({
  render() {
    return <h1>Yo</h1>;
  }
});

React.renderComponent(<App />, document.body);

HTML:

<html>
<head>
  <script src="/bundle.js"></script>
</head>
<body>
</body>
</html>

What does this mean?

13 Answer