ready to build your app

What Is React Native? Is It Worth Using?

React Native is a mobile app development framework that enables the development of multi-platform Android and iOS apps using native UI elements. It is based on the JavaScriptCore runtime and Babel transformers. With this setup RN supports new JavaScript (ES6+) features, e.g. arrow functions, async/await etc.

This famous framework for mobile app development started in the summer of 2013 as Facebook’s internal hackathon project. Its first public preview was released in January of 2015 at Reactjs Conference and in March of 2015, Facebook made React Native open and available on GitHub.

Since then, it has been widely adopted by developers and organizations because of its ability to produce native apps and great User Interfaces. In the graph below, you can visualize the increasing trend for React Native. In just 1.5 years after its release, it overtook Android and iOS development.

See what is React Native and how popular it is.

So now, you should not be surprised by the fact that many of the apps we use today have business logic built using mostly JavaScript rather than Java/Kotlin or Objective-C/Swift. Some of them are Myntra, UberEats, Facebook, and Instagram.

Since we talked about what is React Native, you might be confused about what ‘native app’ means.

What are the native mobile apps?

Native mobile apps are apps which are specifically created for an operating system, either Android or iOS in this case. For building a native app on iOS, we use Objective-C/Swift development language and for Android we use Java/Kotlin.

Coming to React Native, the final User Interface does not simply render a web component inside a WebView. The User Interface is rendered using actual native views and fundamental building blocks that are indistinguishable from the apps built using Swift or Java.

What is React JS?

Before we go into the details of what is React Native, let’s first find out what is React JS:

  • It is a JavaScript library created by Facebook Open Source
  • It is a User Interface (UI) library
  • It is a tool for building UI components

React Native resembles React JS, however, it utilizes native components rather than web component as crucial building blocks. You have to see a portion of the fundamental React ideas, as JSX(JavaScript XML), components, state, and props to grasp the essential structure of a React Native application.

However, if you are interested in building apps in React Native, learning React JS is not strictly mandatory, you can simply start with React Native.

What is React Native?

We have partially answered this question at the beginning of the article. We didn’t, however, address any technical aspects of its architecture. In this section, we will focus on how React Native works.

Let’s start by looking at the default React Native application, like the one below.

1
2
3
4
5
6
7
8
9
10
11
12
import React from 'react';
import { Text, View } from 'react-native';

export default class Brainhub extends React.Component {
   render() {
      return (
         <View>
            <Text>What is React Native</Text>
         </View>
      );
   }
}

Why it doesn’t look like a standard JavaScript syntax

If you are a web developer familiar with older standards of JS only, a portion of the above snippet probably won’t look like JavaScript to you. ES2015 (otherwise called ES6) is a lot of enhancement to JavaScript that is presently a part of the official standard. ES6 isn’t upheld by older browsers, that’s why there is a need of using transpilers like Babel.

Thanks to Babel transpiler React Native supports many features of JavaScript ES2015 (here is the full list), so you can utilize this technology without stressing over its compatibility with different devices. Some of the features of ES2015 in the given snippet are import, from, and class. If you aren’t comfortable with ES2015, you can pick it up just by going through sample codes from the resources listed under the resource section.

1
2
3
<View>
     <Text>What is React Native</Text>
</View>

This is JSX, a grammar for encapsulating XML inside JavaScript. It allows you to write your code inside markup language. It appears like HTML that we use in web development, but instead of using <div> or <span>, you will utilize React Native components. Here, <Text> is a built-in component that just shows some content and View resembles <div> or <span>.

A few words on React Native components

This was an example of displaying “What is React Native”. This line of text acts as a component. Anything you see on the screen is a type of component. It can be really straightforward. The main thing required is a render function, which returns some JSX to render.

Each such component maps to native building blocks when we synthesize our React Native App to Android or iOS Apps. Like in this case <Text> is mapped to <TextView/> in Android and UILabel in iOS.

Is React Native worth using?

React Native, as any other technology has its advantages and disadvantages. Before you decide whether React Native is a good fit for your particular project, have a look at the cheat sheet below.

The pros of React Native:

#1 Timesaving

The primary advantage of this system is that it is timesaving. Initially, it spares the developers from recompiling with each change, since the application reloads right away amid the improvement stage. An Android designer can comprehend the torment.

#2 Easier

The framework empowers the making of a solitary code base that can be blended for iOS and Android. It enables the engineer to invest less energy in coding.

#3 User Experience

A mobile application, imagined with this framework guarantees high caliber, phenomenal execution, and streamlined user experience.

#4 One ecosystem

Besides that, an all-around prepared JavaScript engineer can develop a versatile application utilizing this framework without diving into the ecosystem and language specifics of each OS.

#5 User Interface

The subsequent User Interface is exceedingly responsive and feels liquid on account of asynchronous JavaScript connections with the local condition.

#6 Fast

This implies that the application will have faster loading times and smoother feel than the one built using a hybrid model.

The cons of React Native:

#1 Debugging

It is a complex procedure to debug an app built from React Native. You will have to look into the manner in which React Native produces the code and decide how to act on it.

#2 Configuration

Sometimes, local library coordination inside a React Native application requires plenty of configurations. For instance, a Google Maps outline turns into a long haul work while it takes one moment on an Android Native application.

The competitors of React Native

Ionic and Cordova are some of the other frameworks which are used for similar purposes. They make the so-called hybrid applications. These are created with standard Web innovations and are encapsulated in native fundamental components like WebView. Not at all like React Native, hence it is a genuine overlay to native development.

As we already mentioned, React Native uses native building blocks and is not an overlay to the Operating System. In fact, the JavaScript composed code is synthesized into native codes (fundamental building blocks). So we end up with an application that uses fully native components that are controlled by JavaScript thread instead of web application placed inside WebView component.

The Cordova or Ionic produced graphical interface is shown through a Web View, which expels its productivity and quality and also the client experience. Apps with built with this technology lack in native UX fee.

Summary

In this article, we saw that React Native is similar to React, which itself is a JavaScript library to make interfaces. Consequently, you need to ace web technologies like JavaScript, JSX and even CSS-like stylesheet syntax for component customization. Despite having a few complexities, the React Native Framework has breezed through every one of the tests and obstacles to end up as the first choice for many developers.

Resources

  • https://facebook.github.io/react-native/docs/tutorial
  • https://medium.com/react-native-development/a-brief-history-of-react-native-aae11f4ca39

Matt Warcholinski

Matt Warcholinski is the COO of Brainhub (a software house building awesome node.js web and mobile apps) who loves to build startups and play guitar.

Follow Me: