React Native, v2

About React Native

Kadi Kraman

Kadi Kraman

React Native, v2

Check out a free preview of the full React Native, v2 course

The "About React Native" Lesson is part of the full, React Native, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Kadi talks about the history of React Native, why was it created, and how it works on a high level, and answers questions about working with other languages when using React Native.


Transcript from the "About React Native" Lesson

>> What is React Native, really? So if you look at your phone, your phone is really just a small but incredibly powerful computer. You might have heard this analogy already, but the average smartphone we have nowadays is a million times more powerful than the Guidance Computer that sent humans on the moon, and that is pretty crazy.

But due to their smaller screen and touch base interface, browsing the web on your smartphone is still sub optimal compared to a desktop or a laptop experience. Is the fact that I looked up. The number of smartphone users in the world is 3.5 billion, which is more than was half the world.

And by looking at the global market share, we find that Android and iOS are clearly in the lead, together they make up like 99% of smartphone users. And you might be surprised to find out because a lot of you might have iPhones and might know only people who have iPhones.

You might be surprised to learn that Android is actually way ahead in terms of market share. And it depends on the country. So if you're from the US more than half the people will have iPhones. Same for the UK, I think. But, for example in India, only, like two or 3% of the users have smartphones.

So really the platform that you focus on should really depend on who you're building application for. So if you are, if you know that your target audience will be iPhone users, you can get away with mostly focusing on iPhone. But regardless of who your users are. If you target both Android and iOS, you can be pretty confident that 99% of users will be able to use your app.

Now, because phones are just tiny computers, they have an operating system. And some examples of computers are a MacBook or Adele, or Lenovo, and some examples of operating systems for these computers, are MacOS, Windows or Linux. Now to go into the phone world, some examples of phones are iPhone, or Samsung Galaxy, or Nexus, and some examples of phone operating systems, iOS and Android.

Now applications are designed to run on a particular operating system, so you can't just take an iOS app and run it on Android and vice versa. There's no way you can'have a Windows app to run on Mac. So in order to get to this dream of targeting 99% of our users, we'll have to build two apps, one for Android and one for iOS.

So this is what historically has been the case. You have to have two development teams or two people, or just one person that knows these two environments, because iOS applications are written in Objective C or Swift. And Android applications are written in Java or Kotlin. Now, you can imagine the difficulty in this because it's expensive, it's tedious, it's difficult to track features across two completely different code sets.

And yeah, loads of people were having this problem and so was Facebook, and they decided to have a go at solving it. And this is where React Native comes to play. The goal for React Native was to build a solution that allows you to create fully native apps, not progressive web apps or web views.

How one code base, one development team, one language, and most importantly fully extensible. React Native isn't actually the first or the only such library that aims to do these. But it is incredibly powerful and arguably the best. I mean, obviously, I think it's the best. But this is because, A, we're building fully native apps.

So the compiled React Native application is indistinguishable from a real native application. And secondly, because it's fully extensible, a little existing libraries basically give you this toolbox of things that you can do. But if you want to do anything outside of this, your lost, whereas in React Native, you'll always have the ability to go into the native code and add anything that React Native doesn't already support.

Furthermore, it is open source, you can always help out with adding any features that you think would be awesome. And how does it work? All right, we're not gonna go crazy technical on this. But basically, React Native is built in such a way that it targets the existing compilers.

So there are compilers that accept Java or Kotlin and target the Android platform. And there are compilers that accept Objective C or Swift and target the i OS platform. And this is exactly what React Native hooks into. And the reason this is powerful is because these compilers are already built to handle this.

And it also makes React Native fully extensible to other platforms. So you can have React Native Windows, React Native web, React Native VR, like you could just add more and more compilers here and you can still have this one React Native code. Yes.
>> Just curious in your experience, work with native apps, just through reading like.

I read like two different fronts where they say, you can use solutions like React Native, but there will be a point or a pain point where you're gonna wanna do certain features that native wants to do on their application that React Native might not support it. And then you have to rely on a Swift solutions for iOS, or Java and Kotlin for Android.

I'm just wondering, at this day and age like 2020, the maturity of the React Native API and if you have faced situations where you saw, I cannot take this further just with React Native, where you needed a native solution from those languages.
>> Yes. So I have had a couple of occasions where I've had to build something native.

And once one was for, I think, for Android for linking into a particular mail provider and the other is on my current project, which was actually pre-built before my time, which is integrating with a payment provider that isn't available in React Native. And so the platform fully supports it, this is one of the features of React Native.

It's quite straightforward, I'm gonna say very straightforward, it's quite straightforward to bridge into the native code. So if you have, for example, if you need to add a new module or add a new component, or add some native functionality that interacts with the native Java or Kotlin, or Objective C code, there's a particular entry point and there's really good guides on how to do it.

So, it is for the extensible. It is a bit of like a hustle, like I always like to say that I had written no Objective C code prior to going to React Native, but now I write a security library. So, they kind of lure you in with the promises of just Java Script, and then you kind of start going like, I'll just do this little bit in Java.

So, you do actually get to like learn this new languages. Yeah, so to answer your question, it's a bit of a hassle in that we try to stay in the React Native space as much as possible. But if we have to go outside of it, it's not very hard to customize it infinitely.

>> Is there a category of, or can you sort of categorize which apps you might wanna stay away from with React Native? Like maybe highly graphical intensive or is that works on React Native?
>> So, not at all, you can build anything with React Native. So even though it's JavaScript, we actually hook into the native components for each platform.

So, whereas maybe two years ago, there was a performance hit for certain really memory intensive applications. As we progress, the birth of navigation libraries and React Native itself, have gone more and more performance. You might have heard of Hermes. It's like a new JavaScript compiler that they are building at Facebook currently, which is optimized for JavaScript in React Native.

It's really interesting talk at React Native EU, which is about Hermes. And that's just an example, or one example of the optimizations that they're doing for React Native. So yeah, I don't think there's anything you should really stay away from.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now