Advantages & Disadvantages of React.JS
The world is changing on a daily basis, it’s hard to devote your time to learn new frameworks especially when the framework is ultimately becoming a stand-off. React opens a world of new possibilities such as server-side rendering, real-time updates, different rendering targets like iOS, Android, and many more.
WHAT IS REACT?
React (sometimes referred as React.js or ReactJS) is a Javascript library created by a collaboration of Facebook and Instagram. It allows developers to create fast user interfaces. React views are typically rendered using components that contain additional components specified as custom HTML tags. One of the unique features of React.js is not only it can perform on the client side, but it can also be rendered on the server side, and they can work together interoperably.
It also uses the concept called Virtual DOM, creates an in-memory data structure cache, enumerates the resulting differences, and then updates the browser’s displayed DOM efficiently. This allows the programmer to write code as if the entire page is rendered on each change while the React libraries only render the subcomponents that actually changes.
Every framework has its own advantages and disadvantages. Let’s see the major pros and cons of React.js.
THE GOOD:
React.js is extremely efficient: React.js creates its own virtual DOM where your components actually live. This approach gives you enormous flexibility and amazing gain in performance. React.js also calculates what are the changes needed to be made in DOM. This process of React.js avoids expensive DOM operations and make updates in a very cient manner.
It makes writing Javascript easier: React.js uses a special syntax called JSX, which allows you to mix HTML with Javascript. The user can drop a bit of HTML in the render function without having to concatenate strings, this is another fantastic thing. React.js turns those bits of HTML into functions with a special JSXTransformer.
It gives you out-of-the-box developer tools: When you start your journey with React.js, do not forget to install official React.js chrome extension. It makes debugging your application much easier. After you install the extension, you will have a direct look into the virtual DOM as if you were browsing a regular DOM tree in the elements panel. Isn’t it pretty amazing!
It’s awesome for SEO: One of the biggest issue with Javascript frameworks is that they are not search engine friendly. Though there have been some improvements in this area, search engines generally have trouble reading Javascript heavy applications. React.js stands out from the crowd because you can run React.js on the server, and the virtual DOM will be rendered to the browser as a regular web page.
UI Test Cases: It is extremely easy to write UI test cases because the virtual DOM system implemented entirely in JS.
THE BAD:
* React.js is only a view layer.
* Integrating React.js into a traditional MVC framework such as rails would require some configuration (i.e., substituting erb with React.js).
* There is a learning curve for beginners who are new to web development.
WHY YOU SHOULD USE REACT.JS:
* React.js works great for teams, strongly enforcing UI and workflow patterns.
* The user interface code is readable and maintainable.
* And also, there is now a lot of demand for developers with ReactJS experience.