I'm studying Reactjs. In my website project I have two .js files with codes of react elements and I need to integrate the element from one .js file into the index.html page and the element from the second .js file - into the second .html page. But both elements can display only on the index.html page. I run the project on localhost via command "npm start" using file package.json and node_modules I uploaded. How to display my react element from the second file on the second page of my site?
file "index.html"
<h1>My react element №1</h1>
<div id="app1">
</div>
.........
<script crossorigin
src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-
dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-
standalone/6.25.0/babel.min.js"></script>
<script type="text/babel" src="element1.js">
</script>
file "element1.js"
class Element1 extends React.Component {
/* code */
}
ReactDOM.render(
<Element1/>,
document.getElementById("app1")
);
file "page2.html"
<h1>My react element №2</h1>
<div id="app2">
</div>
.........
<script crossorigin
src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-
dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-
standalone/6.25.0/babel.min.js"></script>
<script type="text/babel" src="element2.js">
</script>
file "element2.js"
class Element2 extends React.Component {
/* code */
}
ReactDOM.render(
<Element2/>,
document.getElementById("app2")
);
file "package.json"
{
"name": "reactapp",
"version": "1.0.0",
"scripts": {
"start": "lite-server"
},
"devDependencies": {
"lite-server": "^2.2.2"
},
"dependencies": {
"create-react-app": "^3.1.1"
}
}