ReactJs Tutorials
What is ReactJs?
What is ReactJs
React is a JavaScript library for building reusable UI components. it is created and maintained by Facebook. Facebook developed ReactJS in 2011, but it was released to the public in the month of May 2013.
React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It is an open-source, component-based front end library which is responsible only for the view layer of the application.
Why we use ReactJS?
ReactJS is to develop User Interfaces (UI) that improves the speed of the apps. React also allows us to create reusable UI components.
React allows developers to create large web applications that can change data, without reloading the page.
It uses virtual DOM (JavaScript object), which improves the performance of the app. The JavaScript virtual DOM is faster than the regular DOM.
We can use ReactJS on the client and server-side.It uses component and data patterns that improve readability and helps to maintain larger apps.
Concept of Virtual DOM (Document Object Model)
The DOM (Document Object Model) is an interface that allows JavaScript or other scripts to read and manipulate the content of a document.
Whenever an HTML document is loaded in the browser as a web page, a corresponding Document Object Model is created for that page. This is simply an object-based representation of the HTML.
JavaScript can connect and dynamically manipulate the DOM because it can read and understand its object-based format. This makes it possible to add, modify contents or perform actions on web pages.
Every time the DOM changes, the browser would need to recalculate the CSS, run layout and repaint the web page. JavaScript updates the DOM much more than they have to. Things become slower due to the process in the browser workflow after DOM manipulation.
So we need a way to minimize the time it takes to repaint the screen. This is where the Virtual DOM comes in.
Virtual DOM without having to redraw all the webpage elements.