When to use react.js

2018-11-13T14:29:33+00:00 13 November|

React.js is one of today’s most requested tools. While sometimes it’s a good option, it’s important to know that every tool has its benefits and others may work better for the development we’re looking for. This is why assessing each specific case is important in order to define the tool to be used. 

App building through the use of developed modules in react.js has great benefits. First of all, it enables the development of auto-contained modules that include all the necessary files for operation without having to develop every app on the store. These modules can be reused in different areas of the same app, and even in different apps. In fact, react.js processes the module once in this setting, regardless of the times it operates. This results in the following:

  • The module needs less memory storage for the client, which also guarantees better performance.
  • This scheme makes modifications easier for those who develop and perform maintenance to the module.

Other tools might need the mapping of all areas that need code modification, as well as the execution, the testing (whether it’s joint or separate), and the production. This requires a high cost, as well as a high investment of time and detail.  On the other hand, react.js just requires modifying one module for the changes to be applied to all the processes where it operates, which speeds up testing and production, while facilitating maintenance, especially regarding big scale deployment.

react.js makes possible the use of ECMAScript 6: the new JavaScript standard that allows a more object-oriented code writing. It involves a modern approach to code creation, which also makes development more solid. The different compilers, such as BabelJS, will transform this code into one that can be understood by the browser, which is the execution environment of our platforms (for example, Cloud Experience).

The truth is that React.js requires a great structure to operate, and its learning curve is a bit more complicated compared to other tools or vanilla javascript, which is counterproductive or very expensive in small applications.

Specifically, with react.js, Flux is often used, which is a way to manage data flow. This calls for the creation of a circuit that can manage events specifically so that the code can execute it. Since the creation and deployment of this flow requires some hours of programming and a CI/CD environment to deploy to production, it’s not practical for functions used only once within the application or for very simple applications. In these cases, using vanilla javascript or some framework more oriented to that is more convenient, in order to solve these tasks more efficiently.

In conclusion, when it comes to large applications, modular programming becomes extremely convenient, and it justifies the hours of programming and the additional use of resources.

Author: Diego Vidal, Software Architect