Environment setup of React Native :
Two Options :
- Expo –
- React Native Cli
Install Expo- CLi : npm i –g expo-cli
Check Version : expo –version
Create New App : expo init projectname
We have a file with the name app.js which is the entry file for react native app.
We have two options to run or test our app first one is the run your app on the Android Emulator which is available in Android studio and another option is to check your app or test your app on your mobile phone by installing the Expo app in your mobile phone in that case you have to scan the bar code it is available in Visual Studio code and then you are up will be Run in your smart phone
New app creation will take some time so it is recommended while you are creating a new react native app project at first time you should save it in another folder so that in future if you are interested to create a new react app in that case you can directly copy and paste it from previously created project so it will save your time and internet data too.
After creating the project we are going to test it in order to execute this app on your mobile phone on your web browser you have to run command expo start this command will open metro builder in the browser at IP http://localhost:19002/. Now we have the various option to check your app on an android Emulator ,xcode for iOS emulator, web browser or in Expo android app which is already installed in your mobile phone. I just want to test this app on my mobile phone so that I will scan the barcode from this metal builder then this app will execute in my mobile phone.
One thing that you should remember your laptop and your mobile phone should be on the same Wi-Fi network otherwise you will get error message of session timeout in your mobile phone in expo app.