REACT JS | Introduction
- What is React js?
React js is an “ Open source library for building user interfaces”, this definition has two key points first, react is a javascript library, not a framework i.e it focuses on one thing and doing well to do that thing, and second, it focuses more on building UI( user-interface). - Why use React js?
It is mainly responsible for building rich UI. React has a rich environment and works really well with other libraries and it is more than capable of building more accomplished web applications. - Why learn React js?
Firstly, react is created and maintained by Facebook. If a company like Facebook invests money and resources to keep its projects alive and it is assured it is not going to die down anytime soon. According to the stateofjs.com survey(Dec 2020), GitHub “Used by” and Stack Overflow survey it is observed that react is the most loved, popular, and wanted library and there are more than 100k stars on GitHub. So, you will be able to find tons of articles and StackOverflow solutions to most of the problems. - Prerequisites?
->HTML,CSS and JavaScript fundamentals.
->Knowledge about modern javascript (ES6) will be beneficial - What are the advantages of using React js?
1)React has a component-based architecture: It lets you break your application into small encapsulated parts which can be composed to make more complex UIs.
For Example:
Let us take the example of a traditional website, here the website can be broken down into a header, side navbar, main content and footer, where each section represents a component which when composed in the right way makes up an entire website.
2)Reusability of components:
Components also make it possible to write reusable code. For enterprise applications, the ability to reuse code is a great plus point.
For example:
From the above diagram, understand you can reuse “ Main Component” on Angular or Vue by simply passing the right data into the main component.
3)React is declarative:
Whatever you want to have on your website, tell react what UI should look like, and React will build actual UI. React efficiently handles updating and rendering of components in the right way (for example,
whenever your data changes DOM updates it is the most precious operation which is effectively handled by React.)