Tip: If you need any help with terminology in this post, see our Glossary.
What is React Native?
Around two years ago, React Native came out – which brought similar ideas to mobile UI development, and by similar we mean it brings web development concepts to the world of mobile development. React Native is in the same category of frameworks as PhoneGap or Cordova, though I’d say its technologically superior.
Why are Developers Choosing Between React Native vs Native Android/iOS Development?
There are two main reasons:
- React Native comes with a big bonus – you could develop an app once in React Native and deploy it on both iOS and Android. The underlying framework doesn’t distinguish between the two platforms. This promise is huge because native Android development and iOS development are quite different and can be expensive – first, the language itself is quite different: iOS uses Objective-C and/or Swift, Android uses Java. And next, all the underlying API’s are different – the way you use the GPS is different, the way to create animations is different, the way you make network calls is different.
How to Build a React Native App
You need knowledge of three things for building apps in any platform:
- The platform’s programming language of choice
- The tools
- The API’s
How to Build a Native Android/iOS App
For native iOS development the languages are Objective-C or Swift. And for Android the language is Java. Tooling wise, you’ll need to use each platform’s IDE (Xcode or Android studio) and learn how that IDE and their debugger and build system works.
While React Native has its origins in web development and borrows many ideas from web, there’s no such point of reference in native iOS or Android development. These are pure native touch-based platforms and you have to study these in their own right. However, knowing one of these makes it fairly easy to learn the other.
Finally, the frameworks – there’s probably the same amount of effort that’s needed, native iOS/Android or React Native. You need to learn how everything can be done programmatically. However, React Native is not likely to support every single API that’s available on iOS or Android.
What’s Easier: React Native or iOS/Android?
On the other hand, Objective-C/Swift/Java are strict languages in the sense that they have a notion of compile time type-checking which eliminates many potential errors even before you run your code.
How Do I Choose Which To Learn?
If you’re exploring app development and want to look for a job someday as an app developer - I’d strongly recommend native iOS or Android for a variety of reasons.
You can also learn React Native – it’s an interesting technology – but there are a few caveats:
- React Native isn’t officially supported by either Apple or Google. So this means there’s a good chance that new announcements from iOS or Android may/may not work perfectly with React Native. For example, when iOS 10 was announced with iMessage apps, I don’t believe there was a React Native way to write such apps. You’d have to know native iOS development for that. And I am not sure even today if you can develop Apple Watch apps using React Native. If you learn native development, these are non-issues.
- Third, we need to keep in mind the longevity of the project. Recall the example of the shutdown of Facebook’s Parse service. At present, React Native seems healthy and a few major companies are backing it but Facebook and others may not have a reason to keep it going forever, unlike Apple and Google who don’t support React Native but will be supporting iOS and Android for as long as anyone can predict. So I’d be careful with React Native.
Swift and React Native are quite new; which is better documented?
Despite being new, Swift is quite well documented. I don’t think I’ve heard anyone complain about a lack of documentation in Swift. In terms of official documentation, React Native is also pretty good. Facebook has plenty of helpful tips and code samples along with regular docs.
Community engagement and StackOverflow-wise, I’d say Swift has an advantage as it has been around a year longer, was launched by Apple as an easier alternative to write iOS apps, and gets promoted by Apple at every opportunity. A quick comparison on the number of questions asked for Swift vs. React Native will show a very large delta. So for now, I don’t think Swift and React Native can be compared as alternatives – Swift is for mainstream iOS development but React Native is still somewhat specialized and appeals to a smaller subset of developers.
What’s Best for Cross-Platform Developers?
A cross-platform developer is someone who wants to build apps for both iOS and Android.
Here’s what you need to keep in mind.
- A typical mobile app has two major components – the app and its server-side backend. Regardless of native or hybrid and iOS or Android, you’ll have a backend which is frequently more than 50% of the development effort. So your choice of platform doesn’t affect 50% of the project.
- Now let’s say you’re doing native iOS and Android. The first platform (say iOS) you’ll do will take time. But once it’s done, the second one will be way faster because less time is spent typing out the code compared with getting the architecture right, getting your class abstractions right, getting the correct layout of the components, and refactoring your code when things change. With the first app done, you’d have already dealt with most of those problems making the second platform a breeze.
- With a hybrid platform, you need to deal with an additional layer of issues to contend with such as bugs and dependency issues. Both will be prevalent with React Native on top of what you already have on the underlying native platforms.
- And if you have some existing code you want to leverage such as an open source C/C++ project or a native game engine – React Native can still leverage those but you’ll have to write some native code which you may have been trying to avoid in the first place. At this point you’ll be expected to have a deep level of native development knowledge to even make such things work.
- Finally, people talk about the various apps that use React Native (Facebook, Instagram, and AirBnB).They were probably written by iOS or Android experts who wanted to use React Native.
In conclusion, I’d say that if your app is simple enough, if it doesn’t need to incorporate relatively new features such as iMessage or to incorporate existing C/C++ type code, or require sophisticated animations etc. – you should be fine with React Native as a start.
And even if your app is fairly complex but you’re an iOS or Android pro and have some web development experience – React Native may be a good choice as you’ll likely resolve everything you need to.
But if you’re new to development, I’d say launch on one platform using its native language first. See how it goes. Then move to the other platform. That’s how Instagram was launched.
4 Obstacles New Coders Will Overcome
Flatiron School co-founder Avi Flombaum shares 4 obstacles you will overcome while learning to code
Node.js: An Intro for Beginners
What is Node.js? Should you learn Node.js? Read this in-depth overview for beginners.
4 Benefits to Learning React
Should you learn ReactJS? See tips from a Sabio Grad!