How to Build a React Native App
In this article, we will learn how to build a React Native app.
Prerequisites
Before we start building a React Native app, make sure you have the following installed on your machine:
- Node.js
- npm
Install Expo CLI
Expo is a CLI tool that helps you build, deploy, and share React Native apps.
npm install -g expo-cli
expo --version
Install Watchman
Watchman is a tool by Facebook for watching changes in the filesystem. It is used by React Native to watch for changes in the project files.
To install Watchman, run the following command:
brew install watchman
Create a New React Native App
To create a new React Native app, run the following command:
expo init my-app
npx create-expo-app@latest my-app -t
This command will create a new React Native app named my-app
.
Run the App
To run the app, navigate to the project directory and run the following command:
cd my-app
npx expo start --web
This command will start the development server and open the Expo DevTools in your default browser.
Run Emulator
To run the app on an emulator, click on the Run on Android device/emulator
or Run on iOS simulator
in the Expo DevTools.
Build the App
To build the app, run the following command:
expo build:android
This command will build the app for Android.
To build the app for iOS, run the following command:
expo build:ios
Conclusion
In this article, we learned how to build a React Native app. Now you can start building your own React Native apps.