React Native, a framework for building cross-platform applications, has been in the news lately for the right reasons. It is backed by a renowned team at Facebook and the whole JavaScript community. The framework aimed to reach record-breaking heights with the slogan “Learn Once, Write Everywhere.” Once Facebook made React Native open source, there were many debates on its likeability of building cross-platform apps using JavaScript. Most of the developer communities were not sure if building apps for two kinds of platform with JavaScript is a right solution. But, React Native surprised everyone with its outstanding performance, which stands on par with native (iOS/ Android) apps. Yet, since it was a relatively new framework, developers faced many performance issues with it while building complex apps.

We will look at six crucial tips that will help mobile developers become better React Native developers.

Correct choice of Navigation Library is important from the start
React Native has a long history of pains and complaints associated with Navigation. Throughout the beginning of version 0.5, many navigational libraries were released and deprecated but only few among them succeeded in maintaining the impact and feel of a native app. However, there might be many situations where developers will find out that the navigational library that they are using in their app is not helpful in creating better user experienced. One possible example of such a use case is Airbnb, which found out that React Navigation which is the recommended Navigational library for React Native was not working with their brownfield app. That’s why developers at Airbnb came up with their own navigational library, which is now the second-most used navigational library after React Navigation.

Native debugging is the old-school way to debug React Native
Debugging in React Native is quite annoying at times when your project size grows. This is because React Native relies on the Chrome Debugger for debugging, which uses the Chrome JS engine, but JavaScript debugging can be only done on JavaScriptCore. This creates a subtle difference between the JavaScript execution environments and developers usually face quite unique problems due to it. The only way for developers to get out of this problem is by doing debugging through Android Studio on Android and Xcode on iOS.

Android Studio: Developers have access to the Android profiler which is hailed as the best tool for Android to analyze an app’s performance such as CPU power, memory, etc.

Xcode: On Xcode, developers can press the Debug View Hierarchy button, which will show all views in a 3D way. Using this, developers can inspect their full view tree in a very visual appealing way.

Upgrading might be a PAIN, so UPGRADE WISELY
At times, developers may want to upgrade their React Native version in order to take advantage of new features. No matter how easy it seems, there might be some situation when it becomes difficult when developers have installed native modules that are linked or bridged to native code. This mostly includes all packages such as React Native Navigation, Google Maps, etc. Moreover, it may so happen that everything that is linked comes crashing down and the app breaks without any warning. Fortunately, there is a way to upgrade React Native wisely, which involves unlinking native packages, upgrading and then relinking them without hassle.

Optimizing Images and other resources is the key to performance
You will most likely agree with the fact that an application is incomplete without Images. Images can be implemented in an application either with the help of a static resource accessed from a local directory or with the help of an external resource that needs to be fetched from a back-end server. Whatever the requirement of a developer might be, it is very important to optimize React Native Images with higher priority. Instead of processing them from the client end and crashing the performance, developers can optimize them at the server level. Moreover, there are many CDN options available to host Images so that developers can easily make API calls and upload images to the server.

Reduce app size on Android and iOS
Most React Native developers are in the habit of using native components and third-party libraries that increase the size of an application. This drastically impacts the performance and loading speed of the application. Developers can follow certain guidelines in order to reduce the size of an application. On Android, this can be done by enabling Proguard and reducing the size of graphics. On iOS, however, this might be a tedious task as iOS does not offer any straightforward solution to solve this problem. Yet, some workarounds can be done that would relatively improve the size of an iOS application.

Don’t fear learning Native code
React Native is a great tool to speed up your native development especially in situations where your business is targeting multiple platforms though there might be some use cases where developers need to implement any functionality that doesn’t exists in the core library. Fortunately, React Native has this problem covered with its pleasant API so developers can use native libraries to implement the required functionality. For this purpose, developers need to have a good understanding of core native languages such as Objective-C / Swift (iOS) and Java / Kotlin (Android). Moreover, it is very important to learn how React Native works under the hood.