As of right now, front-end community has fully embraced React. Still, there are a lot of developers who consciously decide against using React and choose Vue, Angular, or even Svelte. This is not to say that React is not useful. It is in fact the best tool for building interactive interfaces right now. I wanted to dedicate this article to breaking down advantages and disadvantages of React.
Advantages
Easy to figure out
There’s a wealth of information available about React and its practical use cases. Official documentation is well written. In addition to that, there are plenty of video tutorials. Most important React concepts are based on JavaScript. So, if you’re someone who understands JavaScript well, then you can figure out React within few months or even weeks.
Reusable components
React saves you from having to write the same code over and over again. Certain parts of a website usually follow the same pattern and organization. For example, blog posts are all designed the same way and they have the same structure. The only different thing between blog posts is their content – title, text, and so on.
React web apps are like component trees. The same parent component can have many child components of the same type. You create a component once and you can reuse it as many times as you want. Certain components are made up of other components. State and props allow you to maintain data and pass it into child components if necessary.
Virtual DOM
React implements a virtual DOM. This is one integral feature that makes React extremely fast. Virtual DOM is a shadow image of the real DOM. Whenever there are changes in the virtual DOM, React synchronizes virtual and real DOMs and updates it efficiently.
Search Engine Friendly
You can use various static site generators to host your React web app. This way, search engines will be able to index contents on your page. Purely client-based applications can not be indexed in search engines.
Supporting libraries
React is a popular front-end framework with a large community of developers. Naturally, these developers have created a variety of useful packages and libraries for implementing certain features necessary for web development. For example, use form libraries for validation or to clear form after submit.
Disadvantages
Fast pace of updates
React is constantly evolving. Any web developer who wants to build web apps in React needs to stay up to date to changes. For example, React v16.8 brought a lot of changes. It introduced hooks in functional components. This change alone turned a lot of React world upside down.
Sometimes documentation updates are slow and do not follow immediately.
Only a library
Many people mistakenly call React a front-end framework. Actually, React is only a library. It deals with presentational part of the application. It does not have built-in solutions for routing or advanced state management. However, there are many supporting libraries like react-router and redux that help.
JSX
For me personally, JSX is an advantage. It allows you to embed JavaScript expression in the structure. This allows you to create dynamic interfaces. However, there’s definitely a learning curve. Many beginners struggle with rules of JSX. SimpleFrontEnd has excellent guides on how to implement common dynamic features using JSX.