npm install parcel --save-dev
npm install react react-dom --save
{
"source": "src/index.html",
"scripts": {
"start": "parcel",
"build": "parcel build"
},
"devDependencies": {
"parcel": "^2.12.0",
"process": "^0.11.10"
},
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>My App</title>
</head>
<body>
<h1>Hello ...</h1>
<div id="app"></div>
<script type="module" src="index.js"></script>
</body>
</html>
index.js
import { createRoot } from "react-dom/client";
import { App } from "./App";
const container = document.getElementById("app");
const root = createRoot(container);
root.render(<App />);
export function App() {
return <h1>Hello world!</h1>;
}