-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReactJS.txt
38 lines (27 loc) · 1.39 KB
/
ReactJS.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
There are two ways to get started with ReactJS.
First way=>
install npm and node
//web pack used to minify and combine css and js file; plus image files
npm install webpack webpack-dev-server --save-dev
npm install react react-dom --save
//babel convert and build es6 code to es 2015 to support on browsers
npm install babel-core babel-loader babel-preset-es2015 babel-preset-react --save-dev
npm install webpack-cli -D --save
Development Part
webpack.config.js => has dependencies and files from where browser will start rendering
HTML file => a template to with all required elements
JSX file => which component we want to display and how they behave
Second way=>
npm install -g create-react-app
create-react-app my-app
check package.json file
now you can run with npm start
ReactJS with TypeScript =>
First way=>
create-react-app my-app --scripts-version=react-scripts-ts
1. tsconfig.json declares the TypeScript options. It sits at the root of a TypeScript project and indicates the compiler settings and files to include.
2. tslint.json is the linter settings to be used by TSLint.
3. public is the folder of static assets that will be served such as the HTML document and manifest file.
4. src holds the app UI code. This includes our TypeScript components and CSS styling. The traditional index.js file has been replaced by index.tsx as the entry point.
Second way=>
npx create-react-app my-app --typescript