We have two ways to develope React Native apps

  • Expo CLI
  • React Native CLI

Expo CLI

Expo is a set of tools built around React Native and, while it has many features, the most relevant feature for us right now is that it can get you writing a React Native app within minutes. You will only need a recent version of Node.js and a phone or emulator. If you'd like to try out React Native directly in your web browser before installing any tools, you can try out Snack.

 

React Native CLI

To devlope apps with React Native CLI we required Node and npm.

Download Node js from https://nodejs.org/en/download/ and run installer.

After finish open command line chek your node version by

node -v

Node version

Now install ReactNative CLI 

npm install -g react-native-cli

 

Create First Project

E:\Node Workspace>react-native init AwesomeProject

 

Now open this project in Visual Studio Code IDE

 

React Native First Project

Run instructions for iOS:
    • cd "E:\Node Workspace\AwesomeProject" && npx react-native run-ios
    - or -
    • Open AwesomeProject\ios\AwesomeProject.xcodeproj in Xcode or run "xed -b ios"
    • Hit the Run button

  Run instructions for Android:
    • Have an Android emulator running (quickest way to get started), or a device connected.
    • cd "E:\Node Workspace\AwesomeProject" && npx react-native run-android

 

Now run Application

npx react-native run-android

on Running the command you will get like below

Before run application run any emulator or connect real device other wise will get error

info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch

 

Error APK Installation

if you get error on run apk 

react-native doctor

 

it will show list of errors, fix errors one by one and run application

 

on Successful run you will see below result on your mobile

 


Subscribe For Daily Updates