Author |
Uncaught Error: _registerComponent(...): Target container is not a DOM element. |
lakim
Member
Posts: 6
Location:
Joined: 21.07.16 |
Posted on 29-12-2016 19:25 |
|
|
In react application I have raised an error in the browser:
cfb.bundle.js:4 Uncaught Error: _registerComponent(...): Target container is not a DOM element.
at n (cfb.bundle.js:4)
at Object._renderNewRootComponent (cfb.bundle.js:10)
at Object._renderSubtreeIntoContainer (cfb.bundle.js:10)
at render (cfb.bundle.js:10)
at Object.<anonymous> (cfb.bundle.js:1)
at t (cfb.bundle.js:1)
at cfb.bundle.js:1
at cfb.bundle.js:1 |
|
Author |
RE: Uncaught Error: _registerComponent(...): Target container is not a DOM element. |
lakim
Member
Posts: 6
Location:
Joined: 21.07.16 |
Posted on 29-12-2016 19:44 |
|
|
I found the answer:
put your script at the very bottom of the body and render root component to a div before it:
<html>
<head>
</head>
<body>
<div id="root"></div>
<script src="/cfb.bundle.js"></script>
</body>
</html>
and in your code, call
React.render(<App />, document.getElementById('root'));
Edited by lakim on 29-12-2016 19:44 |
|