React Native Pros and Cons: Building Mobile Apps Just Got Simpler
By Jim Karg
React Native is a framework that takes JavaScript code and turns it into native mobile applications for iOS and Android. It fundamentally changes the time, effort, and cost of developing rich mobile applications, because it allows code re-use across web, Android, and iOS. In addition, React Native comes with a library of ready-to-use components. You no longer have to start from scratch in Objective-C, Java, or Swift in order to build a native mobile app.
As a result, major brands are adopting React Native. Facebook invented React Native to make development and deployment easier for its mobile apps. Now, Instagram, Airbnb, Tesla, Skype, and Walmart all use React Native for their apps.
In this article, we’ll take a look at React Native’s advantages, why it’s so popular, and some potential drawbacks you might want to consider. React Native is an incredible technology platform, and most mobile app projects could use it successfully. However, for existing apps or apps that require specific functionality it may not always make sense.
The Story Behind React
React Native is part of a family of React products. The React project comes from developers at Facebook. They wanted to create reliability, consistency, and efficiency across Facebook’s various platforms. They started with ReactJS. It’s a JavaScript framework for building web applications.
React organizes, codifies, and simplifies the development of web applications, specifically user interfaces. It helps developers manage and standardize the relationships between multiple HTML, CSS, and JavaScript files. It also offers a library of commonly needed features, functionality, and components. ReactJS is part of a growing movement of JavaScript frameworks. Similar frameworks like Angular and Vue accomplish similar or complementary goals to React.
React Native is the logical progression of React, from Facebook’s perspective. React made it easier for Facebook to develop its web interface. Next, they wanted a similar simple interface for coding their mobile apps. React Native uses React’s library and syntax extensions. It then converts the React/JSX code into native visual elements. When done right, the resulting mobile apps look and feel like they were developed for native use. Originally, native-looking apps had to be developed in Swift, Objective-C, or Java. Now, React Native takes care of the conversion from JavaScript and JSX to native visual elements, simplifying the app development process.
Shared Code & Pre-Built Components
The beauty of React Native is you only have to build your mobile app once, in JavaScript. React Native takes care of creating separate versions for iOS and Android. For companies that build and maintain their own apps, this effectively cuts the development cost in half. You no longer need separate teams for iOS and Android development.
Additionally, if you have a web application already written using React, you can reuse much of that existing code. Since all the versions of your application now use mostly the same code, updating and adding features becomes a lot easier and quicker.
Further speeding up development is the existence of an open-source library of pre-built components. For many functions you’ll need to deploy in your app, it’s likely someone has already built code with that functionality. As a result, experienced developers can have a basic React Native app up and running in just a matter of hours using pre-built components.
Native Functionality
React Native apps look and feel like they were custom-developed for the iOS or Android device. They also offer access to native functionality. For instance, React Native apps can access the TouchID/FaceID, camera, and accelerometer on your mobile device.
In some cases, React Native might not have a native functionality built-in. The good news is React Native allows developers to drop into Swift, Objective-C, or Java to add that code themselves.
Additionally, React Native allows adding views or user flows to existing native applications. This flexibility allows you to easily build reusable cross platform functionality to applications that are already built and deployed.
Criticisms
JavaScript is one of the most popular coding languages in the world, and there are tons of developers available to build an application for you in JavaScript. However, React projects are not always pure JavaScript. They commonly use syntax extension, called JSX, to allow markup directly with JavaScript. JSX has many advantages including build time checking of markup, providing protection from injection, and other security features. That said, JSX is another thing to learn for new developers. Getting a good handle on these new resources could take time depending on a developer’s familiarity with these concepts.
Finally, if you have an existing app written in Objective-C, Swift, or Java, recreating that app in React Native might not be worth your effort, especially if you already have a deep skill set or knowledge in the native langue and environment of Swift/Objective-C, or Android Studio. A complete switch to React Native would make sense if you plan to release lots of updates for iOS and Android in the future, or have a highly functional JavaScript team already in place. It would also be useful if you were planning on rewriting your web app in React. In this case, consider adding React Native views or flows to your existing application. For existing, low maintenance apps, however, making the switch a complete switch probably isn’t needed.
Conclusion
React Native provides great functionality for developers and users. It’s now easier than ever to quickly build a mobile app that’s fast, intuitive, and consistent with your applications on other platforms. Maintaining and updating an app using React Native is more consistent, efficient, and cost effective than using native code.
If you’re considering a move to React Native, talk to one of our mobile app consultants today. We’ll help you decide if React makes sense for your needs.
Originally published at www.intertech.com on January 29, 2018.