Skip to content

Commit 971f607

Browse files
author
ashch
committed
Created the app and steps
1 parent 2928da2 commit 971f607

File tree

9 files changed

+7363
-1
lines changed

9 files changed

+7363
-1
lines changed

.babelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": [
3+
"@babel/preset-react"
4+
]
5+
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
/node_modules
55
/.pnp
66
.pnp.js
7+
/.cache
8+
/dist
79

810
# testing
911
/coverage

README.md

Lines changed: 115 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,116 @@
11
# react-app-with-minimum-configuration
2-
React app with minimum configuration
2+
3+
In this example I have demonstrated that how to Create a react app with minimum configuration required.
4+
5+
[![dependency Status](https://david-dm.org/ashfaqch/react-app-with-minimum-configuration.svg)](https://david-dm.org/ashfaqch/react-app-with-minimum-configuration#info=dependencies)
6+
[![devDependency Status](https://david-dm.org/ashfaqch/react-app-with-minimum-configuration/dev-status.svg)](https://david-dm.org/ashfaqch/react-app-with-minimum-configuration#info=devDependencies)
7+
8+
## Demo
9+
10+
https://stackblitz.com/github/ashfaqch/react-app-with-minimum-configuration
11+
12+
## Steps:
13+
14+
## Create a new folder for the react app:
15+
16+
_Run following commands._
17+
18+
- `mkdir react-app`
19+
- `cd react-app`
20+
- `npm init` (_npm init will ask you a bunch of questions. Just press enter for the defaults._)
21+
22+
## Install dependencies:
23+
24+
_Run following commands._
25+
26+
- `npm install --save react`
27+
- `npm install --save react-dom`
28+
- `npm install --save typescript`
29+
- `npm install --save-dev @babel/preset-react`
30+
- `npm install --save-dev @babel/preset-env`
31+
- `npm install --save-dev parcel-bundler`
32+
33+
## Create .babelrc file:
34+
35+
_Create the .babelrc file. This file tells parcel that we are using ES6 and React._
36+
37+
```
38+
{
39+
"presets": [
40+
"@babel/preset-react"
41+
]
42+
}
43+
```
44+
45+
## Create tsconfig.json file:
46+
47+
_Create the tsconfig.json file. To define compiler options._
48+
49+
```
50+
{
51+
"compilerOptions": {
52+
"jsx": "react"
53+
}
54+
}
55+
```
56+
57+
## Create index.tsx file:
58+
59+
_Create startup react component._
60+
61+
```
62+
import React from 'react';
63+
import ReactDOM from 'react-dom';
64+
import './index.css';
65+
66+
ReactDOM.render(
67+
<>
68+
<h1>React App</h1>
69+
<p>With minimum configuration using Parcel and Typescript.</p>
70+
</>,
71+
document.getElementById('root')
72+
);
73+
```
74+
75+
## Create index.html file:
76+
77+
_Copy following code to index.html file._
78+
79+
```
80+
<!DOCTYPE html>
81+
<html>
82+
83+
<head>
84+
<title>React App</title>
85+
</head>
86+
87+
<body>
88+
<div id="root"></div>
89+
<script src="./index.tsx"></script>
90+
</body>
91+
92+
</html>
93+
```
94+
95+
## Create index.css file:
96+
97+
_Copy following code to index.css file._
98+
99+
```
100+
body {
101+
background-color: #282c34;
102+
color: #ffffff;
103+
text-align: center;
104+
}
105+
```
106+
107+
## Add a script entry to package.json scripts:
108+
109+
```
110+
"start": "parcel index.html"
111+
```
112+
113+
## Build & Run
114+
115+
1. Run `npm install` to install packages
116+
2. Run `npm start` and navigate to `http://localhost:1234/` to view app.

index.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
body {
2+
background-color: #282c34;
3+
color: #ffffff;
4+
text-align: center;
5+
}

index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<title>React App</title>
6+
</head>
7+
8+
<body>
9+
<div id="root"></div>
10+
<script src="./index.tsx"></script>
11+
</body>
12+
13+
</html>

index.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import './index.css';
4+
5+
ReactDOM.render(
6+
<>
7+
<h1>React App</h1>
8+
<p>With minimum configuration using Parcel and Typescript.</p>
9+
</>,
10+
document.getElementById('root')
11+
);

0 commit comments

Comments
 (0)