Chapter 3. Building Your First Application

In this chapter, we will cover how to set up your local development environment for working with React Native. Then, we will go through the basics of creating a simple application, which you will then be able to deploy to your own iOS or Android device.

Setting Up Your Environment

Setting up your development environment will enable you to follow along with the examples in the book, and will let you write your own applications!

Instructions for installing React Native can be found in the official React Native documentation. The official site will be your most up-to-date reference point for specific installation steps, but we’ll walk through them here as well.

You will need to use Homebrew, a common package manager for OS X, in order to install React Native’s dependencies. Throughout this book, we will assume that you are developing on OS X, which allows you to write both iOS and Android applications.

Once you have Homebrew installed, run the following from the command line:

brew install node
brew install watchman
brew install flow

The React Native packager uses both node and watchman, so if the packager gives you trouble in the future it’s worth updating these dependencies. flow is Facebook’s type-checking library, and is also used by React Native. (If you want to enable type-checking in your React Native projects, you can use flow!)

If you encounter difficulties, you may need to update brew and upgrade any packages (note that these ...

Get Learning React Native now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.