Alaa Werda Hello guys! In this article, I would love to talk about my experience working with React.js a frontend open source library developed at Facebook. I have been working with react over a couple of months and for my amazement, it’s a fantastic library. In this post, I would like to discuss some of the advantages and a few disadvantages of using React.
I have worked with other frontend frameworks like angularJS and angular 2, 4 & 5. Even though Angular gives us some out of box features than React and the learning curve of Angular is more simple when compared to React, React has some awesome benefits over Angular.
The following are some of the awesome benefits of React.
-
React is a library not a framework
Yes, React is a library, not a framework! This makes React more lighter than Angular. This is a major advantage as well as a slightly minor disadvantage. The advantage is that you get the flexibility to use React in the way you want. You can use React with other frameworks like Angular or Vue.js. There are also many state management libraries like Redux and MobX that can be used with React. But for beginners, this becomes a bit difficult because you may end up messing the code without providing a proper file structure to your project, also you need to add other additional libraries like react-router which react does not provide by default.
-
React is the View of MVC
When React was designed the Facebook community designed it in such a way that they provided us only the view. Hence while using React we do the processing and displaying both in the same file. We use JSX syntax to write HTML code. This makes development a bit fast. But also some developers find it weird to write code in JSX and also JSX syntax is a bit different from the normal way of writing HTML code. Suppose we want to provide a flux architecture to React we can use a state management library like Redux or MobX, Which provides a flux architecture to the application.
-
React makes use of the Virtual DOM
React doesn’t manipulate the actual DOM. It manipulates the virtual DOM. That is the javascript representation of the actual DOM in memory. Hence when we change the state only that particular value updates in the DOM without affecting the rest of the DOM that has not changed. This makes React faster.
-
React components are reusable
In react we make use of components and these components can be reused in other projects once developed. It is very easy to build components in React and make them loosely coupled so that they can be used anywhere.
-
React has great community support
The community support behind react is very good. It is also maintained by Facebook as an open source project with regular updates. Currently, version 16.6 is the updated version as of Jan 3rd, 2019.