React Native lets you build native mobile apps using JavaScript and React, the user interface library built by Facebook. It makes it easy to write code for both Android and iOS devices, without having to master both Java (Android) and C++/Objective C (iOS).

Here’s everything you need to know to get up and running with React Native.

Head over to the Node.js download page, and choose the Windows or macOS installer. Linux versions are also available, but you’ll need to do a bit more work to get those installed.

Once downloaded, run the installer, accept the license agreement, and install. Not only do you get Node.js, but you also get npm, which is a JavaScript package manager. With this, you can install other packages—like React Native!

The easiest way to start using React Native is with the create-react-native-app command line program. Open a new terminal or console, and use npm to install it:

npm install -g create-react-native-app

If you encounter a problem installing create-react-native-app, then you may need to fix npm permissions.

Once installed, you’re ready to start creating your app.

Creating an App the Easy Way

Now that you’ve installed create-react-native-app, you can create your first app. Create a new folder to store your project, and navigate to it in the command line.

Use the create-react-native-app utility to create your app. This command will create an app called FirstAndroidApp:

create-react-native-app FirstAndroidApp

React Native has created a new folder for you, based on the name of your project (FirstAndroidApp). Navigate into this folder, and then run:

npm start

This will start your development server.

You’ll see lots of options for restarting the server, along with a QR code and server IP address. You’re all set to run on your phone now.

Running Your App on Your Device

To test your app on your Android device, you’ll need to install an app called Expo. This will connect to your computer, and load your app. Any changes you make will reload the app. It works very well and is an excellent way to develop your app.

Once you’ve installed Expo, ensure your phone is on the same network as your computer. It won’t work on a different network or behind a firewall.

Open the Expo app, and choose Scan QR Code. Point your phone’s camera to the QR code in your command line and after a few seconds, your app will appear on your phone. Back on your command line, you’ll see several new statuses. These tell you that the app has finished building and that it’s running on your device.

By setting the style attribute, you are telling React Native to style your text according to the styles defined previously in the text style.

Play Store Here We Come!

While we only covered the very basics, you’ve now got a solid foundation upon which to build your awesome apps. Don’t stop there though, take a look at the React Native Docs for comprehensive information regarding every React Native feature.

Joe is a graduate in Computer Science from the University of Lincoln, UK. He's a professional software developer, and when he's not flying drones or writing music, he can often be found taking photos or producing videos.