React Native Developers: Create Your First App

DZone 's Guide to

React Native Developers: Create Your First App

A quick tutorial on how to get started using the React Native framework, going over the basic command you'll need to set up your dev environment.

· Web Dev Zone ·
Free Resource

Developing a mobile app entails several challenges. To make things harder, many of these challenges reside in mutually exclusive silos. A good example of this is when you are looking to develop an app in a short period but with great performance. Another case is when you want to publish an app quickly but also want to do so for as many platforms and devices as possible. In such a scenario, there was no choice but to compromise on some aspects when creating your mobile app — until hybrid apps and React Native came along.

A hybrid app framework allows you to overcome the many shortfalls of native app development. An app created using a hybrid framework looks and feels like a native mobile app but unlike the latter, it’s powered by a website. React Native is the most advanced manifestation of this technology. It brings together the best of native applications and React on the web. This means you get the feel, fidelity, and speed of native apps while retaining the best aspects of React on the web, viz. self-contained UI components and fast development cycles.

What Is React Native?

React Native is a mobile app development framework created by Facebook. The framework lets you develop a mobile app that is identical to an app developed using Java or Swift. It also uses the same basic UI elements used by Android and iOS but which are put together using React and JavaScript. Because of this, apps built using React Native appear and function like any other native mobile app instead of truncated WebViews.

What Are the Benefits of Using React Native?

  • Cross-platform versatility – Android and iOS, which are two of the most popular mobile app ecosystems, use different code bases. This compels businesses to invest in both platforms to develop native apps. React Native eliminates this need to develop the same app for Android and iOS individually.
  • Native in form and function – A native app is one that is created specifically for a particular operating system. While there are hybrid app frameworks that claim near-native capability for their apps across different platforms, none comes close to the truly native nature of the apps developed using React Native. The framework lets you share the same codebase across platforms, thus effectively letting you build two discrete apps for the price of one.
  • Easy to use – React Native has a gentle learning curve which aids in faster development and deployment. This is unlike several other frameworks where the learning curve is often steep and has a limited set of use-cases.
  • Less prone to bugs – React Native involves declarative programming, where a developer tells an application what they’re trying to accomplish, instead of imperative programming. With the latter, the developer must specify in detail every step required to achieve the objective. In spite of offering lesser flexibility over how things occur, declarative programming allows developers to describe the state. This can drastically reduce the chances of bugs cropping up in the final product.
  • Efficiency – By its very nature, native app development involves longer time to deployment, lower developer productivity, and higher overall inefficiency. React Native, on the contrary, combines the agility, speed, and responsiveness of web application development with the effective processing and intuitive user experience of hybrid app development. The result is a hybrid app that offers a native app experience.
  • Vast community – Most of React Native’s code is in JavaScript, which is one of the most popular programming languages in the world and has a constantly-evolving ecosystem to boot. This also enables a front-end web developer who knows JavaScript to seamlessly transition into a mobile developer role, which further enhances productivity.

What Is Required to Build Your First App Using React Native?

Now that you know what React Native is and the benefits that can you accrue by using it, it’s time to set up the development environment for the framework. The latter refers to the programs and modules that need to be installed before you start developing an app using React Native.

  • Install Node.js – Node.js is a JavaScript runtime that React Native uses to create your JavaScript code. You can download and install it from its official website. Get the latest LTS (long term support) version as it offers better stability and extended support.
  • Java SE Development Kit (JDK) – Regardless of which OS your system is running on, make sure you’ve installed the latest (or at least newer than version 8) Java SE Development Kit.
  • Native SDKs – Native SDKs are required when developing an app using Reach Native. If you want to develop an iOS application, download and install Xcode which is a free tool. If you are developing an Android application, you will need to install Android Studio. It’s a completely free tool that lets you create an Android app in its native language. Setting up the development environment for Android can appear complex as you’ll need to install several utilities and set the path variables before first use. For a more detailed understanding of the steps involved, you can refer to the official instructions from Facebook itself.

With that, you have completed setting up the development environment and required tools. Now begins the process of building your first app using React Native.

The first step involves installing the React Native CLI (command line interface) using npm, which is a package manager that you installed with Node.js. This tool lets you scaffold a starter project that contains everything you require to create and run an app using React Native. To install it, fire up your terminal and run this command.

Installing the React Native CLIOnce you’ve installed the React Native CLI, you can create a new React Native project by using running the following command in the terminal:

Create a React Native App

You can run the app with whatever content it has on an iOS simulator or an Android emulator/device.
For an iOS simulator, use the command:

Run React Native on an iOS Simulator

For Android, run the commands:

React Native on an Android simulator

These commands build your app and start it in the respective simulator or device. This usually takes a fair bit of time for iOS as all the required files are being built for the very first time. With Android, you can either have the app run on an actual Android device or an Android emulator. Refer to these instructions if you wish to run your app on a real Android device.

After the files are built and indexed, you should see your first React Native app running on a simulator or device.


And that right there is how you create your first app using the React Native framework. Building with React Native can be quite a rewarding experience, especially for first-time users. It lets you visualize and develop your app ideas faster than other frameworks while implementing edits is a straightforward affair. Further, consider the code reusability factor and you realize why React Native developers swear by the framework. 

hybrid app development, mobile application development, react native tutorial, web dev

Published at DZone with permission of peter j . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}