DEV Community


Posted on • Updated on

What is React and why to use it?

React is a modular Javascript library created by Facebook which helps to make web apps fast and efficient with minimal coding.

Why React?
React comes with a wide range of advantages and some of them are as follows:

Easy to learn and easy to use
React comes with a good supply of documentation and tutorials. Anyone who does JavaScript can easily understand React and start using it in just a few days.

Reusable components
React allows a developer to break the app into smaller components that can be reused later hence minimizing the codebase. We will understand more about components in the next section.

Use of virtual DOM
DOM manipulation is one of the most expensive tasks for any framework, especially when the application is big. React solves this issue by using a Virtual DOM, which is basically a lightweight copy of the Real DOM. It is only an in-memory representation and is not rendered on the actual screen.
Instead of rendering the whole DOM again, React compares the changes in Virtual DOM and then renders it in the Real DOM accordingly.

Easy to write JSX
JSX is just a combination of HTML and Javascript. It makes coding a lot easier and also helps in preventing injection attacks like XSS.

Top comments (0)