Moving to React Native and a Single Codebase: the Great, the Good and the Bad
In this article you’ll find how a single codebase can massively improve development productivity, why we’re big fans of React Native, and why it still might not be the right choice for your product.
With a range of benefits that drive improved developer productivity, moving to a single codebase can help with demanding feature release cycles, whilst offering a seamless user experience to the widest possible audience. As recently demonstrated by some major players, a robust and reliable single codebase is increasingly key in the evolving world of App development.
In this article you’ll discover how a single codebase can bring multiple benefits, why we’re big fans of React Native here, and why, despite all that, it still might not be the right choice for your product.
In this article we cover:
- Why choose React Native now?
- How React Native can improve developer productivity
- Tech Considerations before moving to React Native
Why choose React Native now?
React Native has matured a lot over the years, so it’s not just the new hyped framework of the moment. The maintainers of the project (alongside an active community) have been able to consistently make the experience of building React Native applications seamless and smooth. We have seen a significant number of improvements over the last two and half years in terms of prototyping, tooling and testing.
That’s the reason why companies like Airbnb, Discord, Instagram and Walmart have put their eggs into the React Native basket, as it offers not only a faster and simplified way to get applications running into multiple platforms, but also a robust and reliable chain of tools that allows developers to achieve the same results requiring way less resources when compared to their native counterparts.
If a dynamically typed language doesn’t cut it for you, or if you’re working on medium sized/enterprise projects, React Native also has support for using Typescript, which greatly improves the developer experience, especially when you have multiple team members working in the same codebase.
How React Native can improve Developer Productivity
In essence, React Native provides the ability to have a single codebase being used for an Android and iOS app at the same time. In practice that means no more:
- Delayed features in one platform over the other
- Replicating bug fixes for each of your apps
- Technical debt between teams that are working on different projects that do the same thing
And yes, in case you decide to work with other hybrid frameworks like Flutter, Ionic or Xamarin, you can still essentially get the same benefits in terms of having a single codebase, but React Native can enhance your experience as a developer in many more ways, so let’s dig further into the great aspects to consider how this represents a huge increase in productivity:
Another great thing about React Native is that by its very nature it focuses on code composition and componentization, so every piece of a React Native application can be reused in many places throughout the app. That on its own can have a great impact on the productivity of your team depending on how your application is structured, since components are written once and used in several places.
On this note, the React Native community has already created thousands of different components (buttons, text inputs, checkboxes, carousels, modals) that can simply be imported into your project when you want to quickly prototype and launch your idea. On the other hand, if you don’t want to or can’t rely on external libraries, React Native also offers the flexibility to start creating your own custom components to make sure the look and feel of your app is just as you want it to be.
It’s also important to note that many enterprise level third party libraries you’re probably currently using on your native app that have SDK’s that are specific to Android and iOS like Firebase, Sentry and OneSignal already have wrappers for React Native, so you can easily integrate these tools into your application with no need for actually digging deep into native code for either platform.
Tech Considerations before moving to React Native
With all that said you probably already got the idea that React Native is plenty powerful and that it can be used in a variety of situations right? Cool, but don’t get too excited yet because React Native may not be the right technology for you and your project. There are certain drawbacks of using hybrid tools like React Native that you need to be aware of before making the final decision.
First thing you need to understand is that React Native’s performance is close to native, but it’s just not the same. What that means is that if you put a React Native and an Android/iOS app side by side most people will probably not be able to tell the difference, but if you’re the type of developer who cares about every single frame that’s being rendered in the screen, and/or if your application has a really CPU intensive data flow, then it’s probably best if you consider building a native Android/iOS application.
A very simplistic way of explaining why React Native wouldn’t be ideal for those situations is because React Native uses a bridge to communicate with the Native layer of the device, so every time you run a task, there’s a (small) delay from the time you send the request to when you get the response, since the React Native bridge has to pass the data to the Native layer and then send it back to the JS layer of your application.
Even worse, since each platform has different SDK’s to manipulate the hardware it’s running on, there will be lots of limitations in terms of what can be done exactly the same on all platforms. So if you can’t take advantage of React Native’s ability to share code between multiple platforms, it’s most likely a better idea to build native applications for each of the platforms you plan on launching, it’ll be faster, more organized and guaranteed that you’ll be able to achieve your desired results as the project grows.
Last but not least, it’s also important to consider that usually a React Native application has a bigger footprint in the device’s storage when compared to a native application. That may seem like a really edge case since nowadays devices come with up to 1TB of storage, but it may be a deal breaker if you’re planning to release an application that’s going to run on really old devices where storage can be as low as 16GB and users are really concerned about how much space each app is consuming on the device.
We believe that when appropriate a single codebase approach should be favored, but each project and team is different, so now with an understanding of the great, the good and the bad of React Native, analyze your own and make the best decision for your needs—hopefully, that will be an easier task for you with the information shared in this article.