There are two common ways to set up a React Native development environment:
This is a command-line utility for configuring and publishing React Native projects. This is the best way to get started as a beginner. This tool generates a QR code which you can scan to launch the app on your device. As you update your code, the changes will automatically be reflected on your device. In order to preview the app on your device, you'll be prompted to download the
Expo app, which is a React Native app previewing client.
expo-cli utility provides an
eject command to export your app into the same format used by
react-native CLI, which you can then add native modules to.
The company behind
expo-cli, Expo, has been heavily involved in the React Native codebase and community since it's inception, so you can be confident that the tool is well-maintained and doesn't deviate too much from a "standard" React Native setup.
We'll walk through setting up a project in the next section, Quick Start.
React Native CLI
If you're integrating React Native into an existing native app, or if you know you'll need custom native modules in your app, you'll want to use the
react-native CLI to create your app. You can read how to do this on the Facebook docs for environment setup. Click on the "React Native CLI Quickstart" tab.
expo-cli is that
react-native apps require registering the root component of your app using
This allows you to optionally have multiple React Native root components, which you might embed into different native screens.
This code isn't required when using Expo, since Expo only allows one root component. Expo automatically registers the default export of
App.jsas your root component.
The following section will guide you through setting up a React Native app with
Want to learn React Native in-depth?