Article

React Native vs Native iOS/Android

Inside This Article

So you want to be able to build mobile apps for both Android and iOS. Should you learn the individual native languages for each app (for Android that means Java and for iOS that means Swift/Objective-C)? Or should you learn JavaScript to use hybrid framework React Native? There are lots of considerations to take: your existing coding skills, the purpose of your app, and the longevity of the project. Here, Aditya Narayan of mobile bootcamp TurnToTech digs in deep and shares what it takes to build native versus using React Native apps for Android and iOS.

Tip: If you need any help with terminology in this post, see our Glossary.

What is React Native?

React first came out as a way to build user interfaces for the web using JavaScript. It's like any other framework that comes with its tools and best practices except that this one’s from Facebook and web developers really love it. Every framework brings something useful and React brought a clean style to UI development based on the simple idea that the user interface is a function of data – if the data changes, UI should change.

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.

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.

React Native appeals to web developers and lets them get into mobile development with a comfortable learning curve. The way in which developers write apps using React Native is reminiscent of web development with JavaScript as the core language and CSS support along with UI tags that look quite like HTML. Even tooling and architecture is familiar to web developers. Chrome can be used for debugging. There’s also the notion of a DOM. Contrast this with learning native iOS or Android which is not even remotely similar to web development and you’ll see why React Native appeals to web developers.

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

For React Native, for the programming language - you need JavaScript or a slightly different take on JavaScript which mixes JavaScript and HTML type syntax called JSX. The tools for React Native are mostly a text editor and the Chrome debugger and a few tools others for build and testing. And the API’s – there’s a large set of things to learn. The API’s are mostly OS based. Anything that you do on your smartphone today, there’s a programmatic way of doing that which is what the API’s tell you. Here’s a challenge though. You may not have a React Native way of doing everything.

I’d also say that some web development knowledge is a prerequisite for React Native. You can still get started with React Native without any web exposure but then you probably won’t appreciate much of the underlying architecture. You’ll need to know JavaScript, CSS, possibly some HTML, and Object Oriented Programming by the time you’re actually building an app.

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?

JavaScript is easier to learn and easier to debug as opposed to Java, Objective-C, or Swift. However, the ease comes at a cost. JavaScript is not as strict a language and many errors can hide inside your code.

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.

Swift is obviously very modern, but both Objective-C and Java continue to get modernized and aren’t really lacking in any way in terms of modern language features or performance. However, JavaScript has various well-publicized deficiencies which anyone can google.

So React Native may be easier to learn – but it comes with the downsides of JavaScript. And as with any cross-platform framework, you also have to deal with the phenomenon of ‘write-once, debug everywhere.’

Should I Learn React Native?

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:

Every developer should know a strongly typed compiled object oriented language. Java and Objective-C/Swift are all great for that. And whether you want to or not, you will end up learning JavaScript anyways.

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.

Is Swift or React Native 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 The Best Technology 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.

FURTHER READING:

About The Author

Aditya is the co-founder and CEO of TurnToTech mobile development coding bootcamp in New York City. His background is in IT and physics, he has held senior technology roles at Marvel and Starwood Hotels, and founded companies QCD Microsystems and 1to1 Tutor online math tutoring.

related posts

Article

UX/UI Design vs. Web Development

These are the skills you’ll need for each role and the types of jobs you can land after a bootcamp!