My plan is to have a html call a react component (to test the react component, so the 1st thing i'm trying is a react class.
This is my the react file
class Hello extends React.Component {
render() {
return React.createElement("h1", {}, "Hello ");
}
}
const HelloElement = React.createElement(Hello, {name: "World"});
ReactDOM.render(HelloElement, document.getElementById('mydiv'));
This is the html file,
<!DOCTYPE html>
<html>
<script src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/[email protected]/babel.min.js"></script>
<body>
<script src="Hello.js"></script>
<div id="mydiv"></div>
</body>
</html>
But i get Error Decoder which is Target container is not a DOM element.
How to fix this pls ?
<script/>tag after thedivdeclaration.