Is this what you are after? http://codepen.io/PiotrBerebecki/pen/kkyYJv
The script tag to your js file should be put at the bottom of the body tag (below the targeted ids).
HTML:
<head>
<title>React JS</title>
</head>
<body>
<div id="app1"></div>
<div id="app2"></div>
<script src="/index.js"></script>
</body>
</html>
JS:
class Component1 extends React.Component {
render() {
return (
<div>Hello React from Component 1</div>
);
}
}
class Component2 extends React.Component {
render() {
return (
<div>Hello React from Component 2</div>
);
}
}
ReactDOM.render(
<Component1 />,
document.getElementById('app1')
);
ReactDOM.render(
<Component2 />,
document.getElementById('app2')
);