I am working on simple react app, when i used multiple js file Myinfo.js and p2.js. when i try to import Myinfo.js in p2.js file, it doesn't working and showing me nothing on webpage.
I am using babel p2.js file and it is not showing me imported Myinfo.js in page and showing me nothing me on web page.
so how to solve this problem or is there any other way to do the same >>?
here is some code..
index.html :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
<script src="https://unpkg.com/react@17/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" crossorigin></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
<script src="pract/p2.js" type="text/babel"></script>
</body>
</html>
p2.js :
import Myinfo from 'components/Myinfo';
ReactDOM.render(
<Myinfo />, document.getElementById("root")
);
components/Myinfo.js :
function Myinfo() {
return (
<div>
<h1>Country</h1>
<p>This is paragraph about country..</p>
<ul>
<li>India</li>
<li>Japan</li>
<li>Australia</li>
</ul>
</div>
)}
question from:
https://stackoverflow.com/questions/65901871/imported-javascript-file-in-react-is-not-included-in-page-so-how-to-solve-this 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…