Mobile Development with React Native
Initially released in March of 2015, React Native is a framework used to create mobile applications for both iOS and Android. It has come a long way in its nearly 5 years of existence. More stable and performant than ever, React Native appears to be here to stay and remain a powerhouse in the mobile application development market in 2020 and beyond. If you’d like to learn more about the intricacies of the framework, check out their website which includes documentation, community links, their own personal blog, and more.
Why React Native and not traditional native?
In what ways does React Native have a leg up on the old-school method for creating mobile applications?
Single Codebase
Traditionally, applications are built for their specific platform. iOS apps are built using Swift or Objective-C. Android apps are built using Java or Kotlin. Each is its own environment complete with its own frameworks, tools, and development communities.
Oh and one more thing: they each have their own codebase too. Perhaps that doesn’t sound so bad but consider the fact that, in order to create and maintain an application that caters to both iOS and Android users, you must have two different development teams. Each team is comprised of individuals with specific know-how that is only useful for their platform. And you’re paying them both…to write an identical looking app.
If they’re building the same app with the same features and the same UI, wouldn’t it be great if they could write code one time and have it work on both platforms? You already know the answer to this question and the framework that provided said answer is React Native.
React Native provides tremendous flexibility. Now we can create our UI complete with scroll views, search inputs, and all the other native features we desire. And when we build it, it’s ready to ship for both iOS and Android. Remember the multi-team scenario from earlier? Now we only need 1 team. So far, React Native has helped you to halve your resource costs for this hypothetical project. Not bad.
Is that all? Well, no. But, honestly, that is the biggest benefit of the framework and it’s not even close. Let me talk about a couple more.
Code Share with Web Apps
Because React Native uses React — a javascript-based library — you can share code between your web and mobile projects. Now, it’s not going to be like iOS and Android where you can write one time and have it work seamlessly for web(technically you can though with React Native Web). But you can still easily share your services, utils, assets, etc.
That’s not inconsequential! Being able to re-use your service to fetch that user data or post a form submission…that’s time saved. And time saved is money saved. It’s also extremely convenient for developers who would traditionally be considered front-end to navigate your mobile code base with ease. Much in the same way that Node.js opened the door for front-end developers to do backend work, React Native has given them an avenue for mobile development.
OTA Updates
This one is short and sweet. OTA, or “Over the Air”, updates are a feature of React Native which allows you to deploy changes to your production applications without undergoing the traditional deployment processes. So instead of creating a new release and undergoing formal review prior to getting your latest version out, you can just push an OTA update. There are some limitations outlined here, but it’s a pretty cool feature.
Where does traditional native win out?
Performance
That’s a pretty important thing isn’t it? Yes it is. This is not to say that applications built using React Native are slow — they are not. But some functionality can suffer due to the fact that the JavaScript thread communicates with native threads via a “bridge” and sometimes traffic gets backed up so to speak.
“Lagging” aka dropping frames is a very uncommon occurrence and should only be a consideration if you are developing an application which needs to process an unusually high amount of user gesture feedback and/or provide a high amount of continuous animation. This is why I would highly advise against using React Native to build games which rely upon these features.
The other area where performance might suffer is initial load time. The JavaScript bundle can be large in size which could cause the app launch time to suffer. This can be avoided using module lazy load and other code-splitting techniques and in most cases the impact is negligible to begin with.
You decide what’s best
As I’ve explained, I think there are clear cut use cases for React Native. But, like with anything, there are situations where it’s best to avoid it and go full native. Do what is best on a project-by-project basis.