From the course: React Native Essential Training

Why React Native? - React Native Tutorial

From the course: React Native Essential Training

Start my 1-month free trial

Why React Native?

- [Instructor] React Native is a JavaScript framework that allows us to develop native mobile applications for both iOS and Android without having to write code in either Swift or Java. React Native is powered by React, so in React Native applications, we write code using JavaScript with JSX and React Native will bridge our code into native land for both iOS and Android. We can use the same APIs, we use for regular React applications in a React Native application. But there are a few differences that you should be aware of, and we're going to cover these differences in this course. A React Native application will render using real native mobile UI components not Webviews, and it can access native platform features like the camera, address book, contacts and the user's location, all with the JavaScript interface that React Native provides. There are many reasons to consider a React Native over its alternatives, but I'm going to briefly mention the most important ones. If you're already sold on the advantages of React Native feel free to skip this video. Rendering mobile applications using cross-platform frameworks like Cordova or Ionic, which uses a combination of JavaScript, HTML and CSS, typically render using webviews. The performance of these webview based applications is usually not very good when compared with native applications. Additionally, not all the platforms features and APIs can be accessed using webview based application. The user experience overall on a webview based mobile application feels a little off. Facebook actually started their mobile apps using webviews up until 2012 or so. The webview based Facebook application was famous for its slowness and bad overall user experience. React Native on the other hand, does not use webview at all, it acts like a bridge between the code that we write in JavaScript and the native platform it works with. It translates the UI components that we write in React into real native mobile UI elements. We also get all the benefits of the React Library itself, when we develop React Native applications, from the simple but powerful concept of components to the nature of reactive updates that happen automatically when the states of those components change. A coder who can develop React applications can be easily trained to develop iOS apps and Android apps using React Native, removing the need to hire specialized developers on target platforms. Rotating coders among projects becomes more feasible and that inturns improves the knowledge sharing among the team. React Native provides an excellent developer experience over normal mobile applications, this is mostly because of the great set of developer tools that comes built in with the framework. Since it's just JavaScript, all those tools will feel familiar to the web developer, for example, we can debug React Native applications using Chrome Dev tools, we can use any text editor to see the changes we do, all we need is a refresh exactly like in a web application, the build step is not needed as it is when writing normal mobile applications. Additionally, pushing updates to our already published applications can be easier, updates can actually be pushed directly without the App Store review cycle. The code written for iOS applications in React Native can be mostly shared with an Android application, we'll see an example of that as we build an application that gets compiled to both target platforms and most of the code will be shared on those platforms, in fact, the code will be shared by default and when we need to write code for a single platform, we branch off into a special file to do that. Of course, React Native is not perfect, it comes with many disadvantages as well, let me mention a few important ones. React Native is still a bit slower than purely native, there is a communication overhead between the JavaScript thread and the Native UI thread which happens over the React Native bridge. Optimizing React Native applications is essentially optimizing this bridge communication. React Native does not provide complete solutions in JavaScript land, you would still need developers on your team that can work with Swift and Java and fill the gap where needed. React Native is also a fast paced project with frequent breaking changes, so if you're developing a React Native project, you'll need to follow the changes and probably update your project as frequently as you can to deal with smaller changes. In the next video, I'll go over what's needed to develop applications with React Native for both iOS and Android. If you've already built your first React Native app, you can probably skip this next video.

Contents