Just clone the git repo and run bash steps.sh
to reproduce all the steps.
Actions:
make an app folder in the current folder, initialize it and performs all the steps as mentioned in Steps
below
bash steps.sh
- make and initialize folder
yarn init -y
- add parcel
yarn add --dev parcel@next
- add react and react-dom
npm install react react-dom
- make source directory
mkdir src
- make
index.html
andindex.js
insidesrc/
- add
eslint
andprettier
support
npx eslint --init
npm install --save-dev --save-exact prettier
- add
scrips
inpackage.json
"scripts": {
"start": "parcel ./src/index.html --open",
"format": "npx prettier --write src/.",
"lint": "eslint \"src/**/*.{js, jsx}\" --quiet",
"dev": "parcel src/index.html",
"build": "parcel build src/index.html"
},
- make
prettierrc
file asecho {}> .prettierrc.json
- Add content in
index.html
andindex.js
file.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Parcel | App</title>
</head>
<body>
<div id="root"></div>
<script src="./index.js"></script>
</body>
</html>
import React from "react";
import ReactDOM from "react-dom";
ReactDOM.render(
<React.StrictMode>
<h1>Hi</h1>
</React.StrictMode>,
document.getElementById("root")
);