React is only responsible for building rich user interfaces.
React is used to build single-page applications.
Why learn ReactJS?
Today, many JavaScript frameworks/libraries are available in the market(like angular, node), but still, React came into the market and gained
popularity amongst them. The previous frameworks follow the traditional data flow structure, which uses the DOM (Document Object Model).
DOM is an object which is created by the browser each time a web page is loaded. It dynamically adds or removes the data at the back-end
and when any modifications are done, then each time a new DOM is created for the same page. This repeated creation of DOM makes
unnecessary memory wastage and reduces the performance of the application.
Therefore, a new technology ReactJS library was invented which removes this drawback. ReactJS allows you to divide your entire application
into various components. ReactJS still used the same traditional data flow, but it is not directly operating on the browser's Document Object
Model (DOM) immediately. instead, it operates on a virtual DOM. It means rather than manipulating the document in a browser after changes
to our data, it resolves changes on a DOM built and run entirely in memory. After the virtual DOM has been updated, React determines what
changes made to the actual browser's DOM. The React Virtual DOM exists entirely in memory and is a representation of the web browser's
DOM. Due to this, when we write a React component, we did not write directly to the DOM; instead, we are writing virtual components that
react and will turn into the DOM.
Create react App
Install NodJs and npm
We can use this to quickly create the react application. We can simply run this cmd and the entire project will be created for you.
npx is an npm package runner which gets installed when you install node. Since then we are able to run and create react apps without
having to install it. npx takes care of that.
When you start the application, It will open the browser on localhost 3000
Folder structure
package.json - Contains the dependencies and the scripts required for the project.
package-lock.json - It ensures the consistent installation of your dependencies.
node-modules - This is the folder in which all the dependencies are installed. It is generated when running the create-react-app cmd.
public -
index.html - Only one html file we are going to have in the application. We are building a single page application. The view might
dynamically change in the browser. But this html file gets served up. We are not going to add any code here. Here,
the react will control the UI. At runtime react will take this div tag and it will ultimately be responsible for the UI.
src -
index.js - Here we’ll specify the root component which is the <App/> component and DOM element which will be controlled
by react. Here the DOM element is the id with ‘root’. The <App/> component will be rendered in the root element.
App.js - App component is present in the App.js. It is responsible for the html displayed in the browser. App components
represent the view we see in the browser.
App.css - For styling which applied in the App.js.
App.test - For unit test.
index.css - For body tag styling.
Components - It represents the part of the UI. As in the previous image we have 5 components. Header, Footer, Side navigation,
Main content, other to contain the above components that is the root(App) component. Each of the 4 nested
components describes only the part of the UI. However all the components come together to make up the entire
application. Components are also reusable. The same component can be used with different properties. It displays
different information. Eg: The side nav component can be left side/right side nav. It can contain other components.
thanks for sharing this useful information
ReplyDeleteReact Bootstrap Kya Hai?
Bootstrap Kya Hai?
thanks for sharing this useful information
ReplyDeleteReact Bootstrap Kya Hai?
Bootstrap Kya Hai?
An amazing web journal I visit this blog, it's unbelievably wonderful.
ReplyDelete7 Reasons Why You Should Use React Native For Mobile Applications?
Xamarin vs React Native: How To Choose Best Framework For Cross-Platform App Development
Flutter vs React Native – Which to Choose In 2022
List of New React Hooks Introduced in React 18
Thanks For Sharing React Training in chennai
ReplyDelete