How to use react in existing web application with offline library?
- Install Node JS
- Install Visual Studio Code
Process:
- Create a new folder for your project
E:\react-netflix
- Open folder location in “Visual Studio Code”
- Open Terminal [command prompt] Ctrl + `
- Run the following command
> npm init -y [ package.json ]
- Add File System
a) Add a new file by name "README.md" b) Add folders - public it contains static resources. [html, images, docs, audio, video] - src it container dynamic resources [css, scss, less, js, ts, jsx, tsx..]c) Add startup page in public folder - index.html
- React JS requires following libraries to install in project
a) React b) React-DOM c) Babel > npm install react --save > npm install react-dom --save > npm install @babel/standalone --save
Note: All library files are copied into a folder called “node_modules”.
The library files required for React will be in “UMD”, which is a module system
for Javascript.
a) Common JS [CJS]
b) UMD [Universal Module Distribution]
c) AMD [Asynchronous Module Distribution]
etc..
- To enable React in a page you have to link following script files
a) react.development.js [umd] b) react-dom.development.js [umd] c) babel.js [@babel]
- To enable bootstrap in a project you have to install following libraries.
-
>npm i bootstrap bootstrap-icons --save
.