Why Is React Native a Great Choice for Building Mobile Apps. What Changed in Version 0.70?
Summary
- React Native (RN) is a JavaScript framework used to implement mobile apps for iOS and Android
- It is based on React, Facebook’s JavaScript library for building user interfaces. It uses the same design principles, which makes it easy to create a user interface that is both elegant and performant
- The main strengths of the cross-platform approach are centered around the reusability of code
React Native is a JavaScript framework for implementing mobile apps for iOS and Android. It is based on React, Facebook’s JavaScript library for building user interfaces (UI). It is an alternative to the “native” platforms for iOS and Android. Of course, you would have the most control over your app if you developed your product with two native platforms. The time required for you to do so might not be worth it, however. That is also not even to mention it would be much more expensive to do so.
The main strengths of the cross-platform approach are centered around the reusability of code. You don’t have to have two teams focused on iOS, and Android development.
Moreover, React Native uses the same design principles as React, which makes it easy to create a user interface that is both elegant and performant. The platform also has access to native APIs, allowing developers to integrate features like push notifications, location services, and camera into their apps. Additionally, React Native has an active open-source community that has created several libraries for adding features quickly and easily.
Since 2015, many updates and changes have been made to the RN.
Version 0.61 brought the new development experience, “Fast Refresh.” You may see the announcement on the video below. The new feature was written from scratch, and it addressed one of the common pain points of the community.
https://reactnative.dev/img/homepage/ReactRefresh.mp4
Version 0.62 coincided with the release of Flipper, the tool for debugging React Native as well as native apps.
Version 0.69 brought numerous improvements, most of them centered around bundling Hermes by default, and introducing React 18. Hermes is a new JavaScript engine, which is smaller and faster than the previously used JavaScriptCore (JSC).
Earlier in 2022, Meta has shipped several accessibility fixes to the framework, including, but not limited to:
- Disabled state not announced/disabled functionality not applied for some components
- Position in collection not supported by some components
- Make links independently focusable by Talkback
Of course, there were plenty of breaking changes to the framework, as well. One of them was the removal of navigators from the core. Developers adapted and moved forward: we have React Native Navigation. We will now highlight two of the main changes that version 0.70 brought.
New Architecture (Fabric)
The new architecture abandoned the bridge concept in favor of a different communication mechanism: the JavaScript Interface (JSI). JSI is an interface that allows a JavaScript object to contain a reference to C++ and vice versa. This idea has opened several advantages:
- Synchronous Execution: It is now possible to execute synchronously functions that were not originally intended to be asynchronous.
- Concurrency: JavaScript can call functions that run on different threads. Less overhead: The new architecture no longer needs to serialize/deserialize data; therefore, there is no need to pay serialization taxes.
- Code Sharing: With the introduction of C++, all platform-independent code can now be abstracted away and easily shared across platforms.
- Type safety: To ensure that JS can correctly call methods on C++ objects and vice versa, a layer of auto-generated code has been added. The code is generated starting from some JS specification that needs to be typed through Flow or TypeScript.
Hermes as the Default Engine
Hermes is an open-source JavaScript engine optimized for React Native. For many applications, using Hermes will improve startup time, reduce memory usage, and reduce application size compared to JavaScriptCore. Hermes uses React Native by default, and no additional settings are required to enable it. RN allows you to create many different types of applications. This is possible with push notifications, navigation, camera, mobile storage, and many other additional APIs.
Some large companies do not choose RN. For projects with more than 50 contributors, RN is probably not a good solution. Of course, making it work is not impossible; it is challenging, for sure. The bare minimum of imposed rules does not help here.
Breaking Changes
The newest release of the framework for creating mobile apps included aspects that could have broken your apps.
They include:
Removed jest/preprocessor from the react-native package (0301cb285b by @motiz88)
Remove nonstandard Promise.prototype.done (018d5cf985 by @motiz88)
For the full list, please go here.
Pros and Cons of React Native from the Perspective of a React Native Developer
React Native, overall, has its pros and cons. Regardless of the platforms or versions, there are some aspects that do not change over the years
Pros
- React Native allows for faster development cycles compared to native platforms;
- It allows developers to share code across platforms, meaning that a single codebase can be used to create apps for both iOS and Android;
- It is relatively easy to create attractive UI designs with React Native;
- Developers have access to the same native APIs as they would if they developed natively;
- There are several open-source libraries available, making it easier to add features quickly.
Cons
- React Native requires knowledge of the native platforms, as well as JavaScript (possibly TypeScript), and React;
- Limited customization options compared to native apps;
- Community support is not as robust as for native development;
- Third-party plugins are not always available, which can limit functionality;
- React Native applications can be more difficult to debug than native applications.
Conclusion
React Native is a great choice for building mobile apps due to its advantages such as faster development cycles, code sharing across platforms, easy UI designs, access to native APIs, and availability of open-source libraries. However, it also has some disadvantages, such as requiring knowledge of the native platforms and limited customization options.
Ultimately, the choice of whether to use the framework depends on the specific requirements of the project. Of course, it’s also hard to miss React Native’s biggest rival: Flutter. Even though apps written using the framework suffer some serious issues, the answer to the question “React Native vs Flutter” isn’t so simple. In case you want to discuss using React Native in any of your projects, do not hesitate to contact our experts.
Originally published at https://www.itmagination.com.