Advantages and Disadvantages of React Native
RN is a popular platform for creating projects of all kinds. Those who are good at it can write projects for different platforms. Although you will have to consider some of the features of this tool if you decide to use it to implement your ideas. What do you need to know, asking for help from the React Native development agency?
RN consists of the following components:
- Yoga.
- JavaScript Virtual Machine.
- Native ModulesBridge.
Yoga
Yoga is a UI engine written in C++. Its main task is to standardize the UI so that regardless of the platform, the code is the same.
Because of this, the UI in React Native development is completely native. The whole system runs on flexboxes. However, this engine does not implement all the functionality of CSS Flexbox. For example, it lacks non-layout properties responsible for color.
Although Yoga is a part, it can exist and be used separately. YogaKit for React Native development helps with this. I suggest reading more at this link.
I also want to mention a cool playgroup on the Yoga site. With it, you can change different blocks and parameters and better understand how everything works. For example, change the layout of elements from horizontal to vertical and remove paddings.
JavaScript Virtual Machine
It handles JS code, so you can run it on different platforms. But there is one aspect. JavaScripCore is also an engine for the Safari browser. In iOS projects, due to security reasons, JavaScripCore doesn’t handle JIT compilation (Just-in-Time). This is because Apple doesn’t allow any third-party processes to run dynamic code.
Therefore, the virtual machine runs in a slow-down mode of interpretation. That’s why things don’t go quite the way they’re supposed to. The reason lies in the design of JSVM. It consists of parts responsible for parsing, interpreting, etc.
Bridge
This element is almost a strategic object. A bridge allows bidirectional asynchronous non-blocking communication between queues.
Because of the asynchronous and bidirectional nature of Bridge, it is both a strength and a weakness of the current architecture. Up to a certain point, it allows you to keep a good performance. And if you change communication from asynchronous to synchronous, even minor operations that require feedback will be blocked.
Advantages of RN
Declarative UI
This is a convenient approach to writing UI. For example, here is a snippet from my test project. This is a normal Login-skin: with two text fields and Login and SignUp buttons. The snippet contains a small amount of code. But it doesn’t specify how to create these elements or how they are connected to each other. That is, I don’t write it in code, which saves me a lot of effort and time.
Hot Reloading
Gives you the ability to make changes to code which are instantly displayed on the device or simulator without recompiling the modified files.
Code push
This cloud-based service allows updates to be deployed directly to the user’s devices without going through a review. But this is only reasonable for JS changes. Native code updates will still require a review. You can also roll back to a previous version.
Stories & Storybook
Provides a way to create libraries of UI components (text fields, batters, switchers) and store them in any repository. The web interface will pull all created components. You will also be able to interactively change their parameters. It is useful in case of future modifications in the product design.
Disadvantages
Dependence on the community
The community is both an advantage and a disadvantage. After all, its creation is quite chaotic. There are very useful and interesting UI libraries that could not be used because their last update was several years ago. Such moments are very depressing for a developer.
This is still a beta version
A significant limitation that makes it impossible to be completely confident in RN. Doesn’t have a single React Native development center to keep the process under control. Facebook appeals to change and sometimes offers improvement.
Productivity
Productivity is at an adequate level. But there can be problems with specific tasks. I’ve already had experience with projects with complex video processing where React Native development didn’t handle it at all.
Myths about RN
Facebook and Instagram are written with React Native development
This is a very successful marketing move. It attracts a lot of interest in the tool. After all, developers seem to have an opportunity to work on which such powerful projects are created.
In fact, Facebook and Instagram developers once created only separate modules on RN. They still have them in apps, but it’s an RN integrated into the native environment.
Two apps for the price of one
The conventional wisdom, an investor can save money on React Native development apps for different OS. This is almost impossible. Sometimes it is possible to save money. But the budget of the project is influenced by the features of the specific product, its functionality, and the process of React Native development. For example, if the project is small, then using RN will really speed up the work. Today, most apps are complex and voluminous. So the savings are not that significant.
A cool tool for MVPs
If you choose React Native, you should have a detailed roadmap of the app with a list of planned functionality for prototyping. If you don’t have such a list, you may later add features that are problematic to implement through React Native development. You’ll have to spend a lot of time fixing things. With the new architecture, this situation will change.
Conclusions
Of course, it is a great tool, but for certain tasks. You can hammer a nail with a screwdriver; but why when there is a hammer? You will reach the goal, but you will suffer in the process. The result will not meet your expectations. It’s the same with RN.
On the one hand, marketing has brought attention to React Native development. Around it, a strong community of developers was formed, which gave impetus to developing. On the other hand, a lot of myths have appeared which prevent proper understanding of the tool’s capabilities.