Install with CLI
React Native CLI requires Xcode or Android Studio to get started, so if you have experience with mobile programming, you might want to use it. You should be able to start using one of these programmes right away if you already have one installed.
Installing the React Native CLI is comparatively simpler with NPM. Use the Powershell or Command Prompt on the system to run the following command to complete the installation.
npm install -g react-native-cli
New Application Creation
The react-native CLI now allows you to start a new React Native project.
react-native init LearnCodeZone
The project name I’ve selected for this is LearnCodeZone.
Running the Application
Now we may launch the project we generated on our Android phone. We must first configure our mobile device in order to do this.
The AVD (Android Virtual Device) is an additional option for running your application, and we can construct that on the Android Studio; however, we won’t be focused on that in this post.
Set up Android Device
In order to run the React Native application we developed, we must first enable USB debugging on our Android smartphone.
- Go to Settings-> About on your Android device to get the Build Version menu.
- Once the developer options are enabled, keep clicking the Build Version option.
- Return to Settings now and select Developer Options.
- Activate the USB debugging option in Developer Options.
Utilize a USB cable to connect your mobile device to the Windows operating system. To check that your mobile device is connected, type the following command.
ADB devices
Launch the react native app on your smartphone by typing the following command.
react-native run-android